|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/leadai/leadai.co.in/resources/views/deals/ |
Upload File : |
@extends('layout')
@section('content')
<main class="main-content">
<div class="container">
<!-- begin::page header -->
<div class="page-header border-0">
<h3> Edit @php echo \App\Helpers\Frontend::deal_name(); @endphp</h3>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ asset('dashboard') }}">{{ __('message.dashboard') }}</a></li>
<li class="breadcrumb-item" aria-current="page"><a href="{{ asset('deals/list') }}">list</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ __('message.edit') }}</li>
</ol>
</nav>
</div>
<!-- end::page header -->
<div class="row">
<div class="col-md-12">
<x-flashMessage />
<div class="card">
<div class="card-body">
<form action="{{ route('deals.update', Request::segment(3)) }}" method="post">
@csrf
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="user_id">User <span class="text-danger">*</span></label>
<select class="form-control " name="user_id" id="user_id">
<option disabled selected>Select User</option>
@if (!$users->isEmpty())
@foreach ($users as $user)
<option value="{{ $user->id }}"
{{ $user->id == $deal->user_id ? 'selected' : '' }}>
{{ $user->name }}</option>
@endforeach
@endif
</select>
@if ($errors->has('user_id'))
<div class="error">
{{ $errors->first('user_id') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="form-group ">
<label> {{ __('message.name') }} <span class="text-danger">*</span></label>
<input type="text" class="form-control" name="name" id="name"
value="{{ $deal->client_name }}">
@if ($errors->has('name'))
<div class="error">
{{ $errors->first('name') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="form-group ">
<label>{{ __('message.email') }} <span class="text-danger">*</span> </label>
<input type="email" class="form-control" name="email"
value="{{ $deal->client_email }}">
@if ($errors->has('email'))
<div class="error">
{{ $errors->first('email') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="row">
{{-- Code --}}
<div class="col-md-4">
<div class="form-group">
<label for="phone">Country</label>
<select class="form-control" name="phonecode">
@if (!$country_codes->isEmpty())
@foreach ($country_codes as $country_code)
<option value="{{ $country_code->phonecode }}"
{{ $country_code->phonecode == $deal->phonecode ? 'selected' : '' }}>
+{{ $country_code->phonecode }}</option>
@endforeach
@endif
</select>
</div>
</div>
{{-- phone --}}
<div class="col-md-8">
<div class="form-group">
<label>{{ __('message.phone') }} <span class="text-danger">*</span>
</label>
<input type="number" class="form-control " name="mobile"
id="mobile" value="{{ $deal->phone }}">
@if ($errors->has('phone'))
<div class="error">
{{ $errors->first('phone') }}
</div>
@endif
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Pipeline <span class="text-danger">*</span></label>
<select class="form-control " name="pipeline_id" id="pipeline_id">
<option>Select Pipeline</option>
@if (!$pipelines->isEmpty())
@foreach ($pipelines as $pipeline)
<option value="{{ $pipeline->id }}"
{{ $pipeline->id == $deal->pipeline_id ? 'selected' : '' }}>
{{ $pipeline->name }}</option>
@endforeach
@endif
</select>
@if ($errors->has('pipeline_id'))
<div class="error">
{{ $errors->first('pipeline_id') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Stage <span class="text-danger">*</span></label>
<select class="form-control " name="stage_id" id="stage_id">
<option>Select Stage</option>
@if (!$lead_stage->isEmpty())
@foreach ($lead_stage as $stage)
<option value="{{ $stage->id }}"
{{ $stage->id == $deal->stage_id ? 'selected' : '' }}>
{{ $stage->name }}</option>
@endforeach
@endif
</select>
@if ($errors->has('stage_id'))
<div class="error">
{{ $errors->first('stage_id') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Source <span class="text-danger">*</span></label>
<select class="form-control " name="source_id" id="source_id">
<option value="">Select Source</option>
@if (!$sources->isEmpty())
@foreach ($sources as $source)
<option value="{{ $source->id }}"
{{ $source->id == $deal->sources ? 'selected' : '' }}>
{{ $source->name }}</option>
@endforeach
@endif
</select>
@if ($errors->has('source_id'))
<div class="error">
{{ $errors->first('source_id') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Products <span class="text-danger">*</span></label>
<select class="form-control " name="product_id" id="product_id">
<option value="">Select Product</option>
@if (!$products->isEmpty())
@foreach ($products as $product)
<option value="{{ $product->id }}"
{{ $product->id == $deal->products ? 'selected' : '' }}>
{{ $product->name }}</option>
@endforeach
@endif
</select>
@if ($errors->has('product_id'))
<div class="error">
{{ $errors->first('product_id') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Branch</label>
<select class="form-control" id="branch_id" required
placeholder="Select Branch" name="branch_id">
<option>Select Branch</option>
@if (isset($branches))
@foreach ($branches as $branch)
<option value="{{ $branch->id }}">{{ $branch->name }}</option>
@endforeach
@endif
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Order </label>
<input type="number" class="form-control" name="order"
value="{{ $deal->order }}">
@if ($errors->has('order'))
<div class="error">
{{ $errors->first('order') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Price </label>
<input type="number" class="form-control" name="price"
value="{{ $deal->price }}">
@if ($errors->has('price'))
<div class="error">
{{ $errors->first('price') }}
</div>
@endif
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Notes </label>
<textarea class="form-control" name="notes">{{ $deal->notes }}</textarea>
@if ($errors->has('notes'))
<div class="error">
{{ $errors->first('notes') }}
</div>
@endif
</div>
<div class="d-flex justify-content-end">
<button type="submit" class="btn btn-success">Update</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- end::main content -->
@endsection
@push('footer-script')
<!-- begin::select2 -->
<link rel="stylesheet" href="{{ asset('public/admin/vendors/select2/css/select2.min.css') }}" type="text/css">
<script src="{{ asset('public/admin/vendors/select2/js/select2.min.js') }}"></script>
<!-- end::select2 -->
<script>
$(document).ready(function() {
$('#js-example-basic-roles').select2({});
});
$("#billing_country").on("change", function() {
var company_id = $(this).val();
stateFetch(company_id, "billing_state");
});
$("#location_country").on("change", function() {
var company_id = $(this).val();
stateFetch(company_id, "location_state");
});
function stateFetch(company_id, appendState) {
$.ajax({
type: "post",
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
"id": company_id
},
url: "{{ asset('fetch-state') }}",
dataType: "html",
success: function(result) {
$("#" + appendState).html("");
var allData = JSON.parse(result);
if (allData.message == "success") {
var data = allData.data;
var i;
var dOption = "<option selected disabled>--Select--</option>";
$("#" + appendState).append(dOption);
for (i = 0; i < data.length; i++) {
var option = `<option value="${data[i].id}">
${data[i].state_name}
</option>
`;
$("#" + appendState).append(option);
}
} else {
console.log("failed");
}
},
error: function(xhr, error, status) {
console.log(JSON.parse(xhr.responseText));
}
});
}
//location city code
$("#location_city").on("click", function() {
//var search = $(this).val();
$(".location_city_search_box").html("");
if ($(".main-add-city-box").hasClass("d-none")) {
$(".main-add-city-box").removeClass("d-none");
$(".add-search-city-box").removeClass("d-none");
var typed_city = `
<input type="search" class='form-control border px-2 search-city-val'
style='list-style:none;cursor:pointer;'>`;
$(".add-search-city-box").html(typed_city);
$(".search-city-val").focus();
$(".search-city-val").on('input', function() {
$(".location_city_search_box").removeClass("d-none");
var search = $(this).val();
$.ajax({
type: "post",
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
"search": search
},
url: "{{ asset('search-city') }}",
dataType: "html",
success: function(result) {
$(".location_city_search_box").html("");
var allData = JSON.parse(result);
if (allData.message == "success") {
//$(".location_city_search_box").removeClass('d-none');
var data = allData.data;
console.log(data);
var i;
var new_li = `<li class='text-capitalize rounded new_city_add_btn text-white p-2 mb-2' addcity="${search}" style='list-style:none;cursor:pointer;background:grey'>
Add  "${search}"...</li>`;
$(".location_city_search_box").append(new_li);
for (i = 0; i < data.length; i++) {
var li = `<li class='text-capitalize rounded city_name_li bg-dark text-white p-2 mb-2' city='${data[i].city_name}' style='list-style:none;cursor:pointer;background:grey'>
${data[i].city_name}</li>`;
$(".location_city_search_box").append(li);
}
$(".city_name_li").click(function() {
var city = $(this).attr('city');
console.log(city);
$("#location_city").val(city);
$(".location_city_search_box").addClass('d-none');
$(".main-add-city-box").addClass("d-none");
$(".add-search-city-box").addClass("d-none");
});
} else {
console.log("failed");
var new_li = `<li class='text-capitalize rounded new_city_add_btn bg-dark text-white p-2 mb-2' addcity="${search}" style='list-style:none;cursor:pointer'>
Add  "${search}"...</li>`;
$(".location_city_search_box").append(new_li);
}
$(".new_city_add_btn").click(function() {
var city = $(this).attr('addcity');
var loc_city = $("#location_city").val(city);
// alert(loc_city);
//var city_name = $("#b_city_name").val();
addCity(city, "main-add-city-box", "location_city");
});
},
error: function(xhr, error, status) {
console.log(JSON.parse(xhr.responseText));
var new_li = `<li class='text-capitalize rounded new_city_add_btn bg-dark text-white p-2 mb-2' addcity="${search}" style='list-style:none;cursor:pointer'>
Add  "${search}"...</li>`;
$(".location_city_search_box").append(new_li);
}
});
});
} else {
$(".main-add-city-box").addClass("d-none");
}
});
//city code
$("#billing_city").on("click", function() {
//var search = $(this).val();
$(".billing_city_search_box").html("");
$(".billing-main-add-city-box").removeClass("d-none");
$(".billing-add-search-city-box").removeClass("d-none");
var typed_city = `
<input type="search" class='form-control innder-border border search-city-val'
style='list-style:none;cursor:pointer'>`;
$(".billing-add-search-city-box").html(typed_city);
$(".search-city-val").focus();
$(".search-city-val").on('input', function() {
$(".billing_city_search_box").removeClass("d-none");
var search = $(this).val();
$.ajax({
type: "post",
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
"search": search
},
url: "{{ asset('search-city') }}",
dataType: "html",
success: function(result) {
$(".billing_city_search_box").html("");
var allData = JSON.parse(result);
if (allData.message == "success") {
//$(".location_city_search_box").removeClass('d-none');
var data = allData.data;
console.log(data);
var i;
var new_li = `<li class='text-capitalize rounded new_city_add_btn p-2 mb-2' addcity="${search}" style='list-style:none;cursor:pointer;background:#ddd'>
Add  "${search}"...</li>`;
$(".billing_city_search_box").append(new_li);
for (i = 0; i < data.length; i++) {
var li = `<li class='text-capitalize rounded city_name_li p-2 mb-2' city='${data[i].city_name}' style='list-style:none;cursor:pointer;'>
${data[i].city_name}</li>`;
$(".billing_city_search_box").append(li);
}
$(".city_name_li").on('mouseover', function() {
$(this).css({
'background': '#ddd',
'color': 'white'
});
});
$(".city_name_li").on('mouseleave', function() {
// Reset background and text color when mouse leaves
$(this).css({
'background': '',
'color': ''
});
});
$(".city_name_li").click(function() {
var city = $(this).attr('city');
console.log(city);
$("#billing_city").val(city);
$(".billing_city_search_box").addClass('d-none');
$(".billing-main-add-city-box").addClass("d-none");
$(".billing-add-search-city-box").addClass("d-none");
});
} else {
console.log("failed");
var new_li = `<li class='text-capitalize rounded new_city_add_btn bg-dark text-white p-2 mb-2' addcity="${search}" style='list-style:none;cursor:pointer'>
Add  "${search}"...</li>`;
$(".billing_city_search_box").append(new_li);
}
$(".new_city_add_btn").click(function() {
var city = $(this).attr('addcity');
var loc_city = $("#billing_city").val(city);
// alert(loc_city);
//var city_name = $("#b_city_name").val();
addCity(city, "billing-main-add-city-box", "billing_city");
});
},
error: function(xhr, error, status) {
console.log(JSON.parse(xhr.responseText));
var new_li = `<li class='text-capitalize rounded new_city_add_btn bg-dark text-white p-2 mb-2' addcity="${search}" style='list-style:none;cursor:pointer'>
Add  "${search}"...</li>`;
$(".location_city_search_box").append(new_li);
}
});
});
});
$(".location-add-city-btn").click(function() {
if ($(".location-add-city-box").hasClass("d-none")) {
$(".location-add-city-box").removeClass("d-none");
$(".location-add-city-box").removeClass("animate__animated animate__fadeOut");
$(".location-add-city-box").addClass("animate__animated animate__bounceInRight");
$(".location-add-city-box i").removeClass("fa-plus");
$(".location-add-city-box i").addClass("fa-minus");
} else {
$(".location-add-city-box").removeClass("animate__animated animate__bounceInRight")
$(".location-add-city-box").addClass("animate__animated animate__fadeOut");
$(".location-add-city-box").addClass("d-none");
$(".location-add-city-box i").removeClass("fa-minus");
$(".location-add-city-box i").addClass("fa-plus");
}
});
$(".l-city-form-btn").click(function() {
var city_name = $("#l_city_name").val();
addCity(city_name, "location-add-city-box", "location_city");
});
function addCity(city_name, cityformBox, city_input) {
$.ajax({
type: "post",
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
"city_name": city_name
},
url: "{{ asset('add-city') }}",
dataType: "html",
success: function(result) {
console.log(result);
var allData = JSON.parse(result);
if (allData.message == "success") {
$("." + cityformBox).addClass("d-none");
$("." + city_input).val(allData.data);
} else {
//console.log("failed");
}
},
error: function(xhr, error, status) {
console.log(JSON.parse(xhr.responseText));
}
});
}
function openTab(tabId) {
// Get all tabs and hide them
var tabs = document.querySelectorAll('.tab-content');
tabs.forEach(function(tab) {
tab.classList.remove('active');
});
// Remove active class from all tabs
var tabButtons = document.querySelectorAll('.tab');
tabButtons.forEach(function(button) {
button.classList.remove('active');
});
// Show the clicked tab and add active class
document.getElementById(tabId).classList.add('active');
document.querySelector('[onclick="openTab(\'' + tabId + '\')"]').classList.add('active');
}
$(".billing-btn-toggle").click(function() {
if ($(".billing-address-main").hasClass('d-none')) {
$(".billing-address-main").removeClass("d-none");
} else {
$(".billing-address-main").addClass("d-none");
}
});
</script>
@endpush