CHANGE_ML_JOB_CARD_QUICK_CREATE_SERVICE_DESCRIPTION_ : AADHAVAN

This commit is contained in:
aadhavan valli 2024-05-30 13:52:36 +05:30
parent a75f6fb3c0
commit 0142d408c0
14 changed files with 252 additions and 185 deletions

View File

@ -16,6 +16,8 @@ class Business extends BaseController
$business=$BusinessModel->findAll();
$data['business']=$business;
// echo "<pre>";
// print_r($data);die;
return view('business_list',$data);
}

View File

@ -163,7 +163,12 @@ class Vehicle extends BaseController
$register_find = $VehicleModel->where('reg_no',$reg_no)->first();
return json_encode($register_find);
if ($register_find) {
return json_encode($register_find);
}else{
return json_encode(false);
}
}
}

View File

@ -14,7 +14,7 @@
<div class="col-md-12">
<div class="card">
<div class="card-body">
<form action="<?= base_url() . "edit_branch_form/". session()->get('logged_user_branch_id'); ?>" method="post">
<form id=branch_add_form action="<?= base_url() . "edit_branch_form/". session()->get('logged_user_branch_id'); ?>" method="post">
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4" class="col-form-label">Branch Name</label>
@ -35,11 +35,11 @@
</div>
<div class="form-group col-md-6">
<label for="inputAddress" class="col-form-label">Contact 1</label>
<input type="text" class="form-control" name="contact_1" placeholder="Contact 1" value="<?= isset($branch['contact_1']) ? $branch['contact_1'] : '' ?>" required maxlength="10" minlength="10">
<input type="text" class="form-control" name="contact_1" placeholder="Contact 1" value="<?= isset($branch['contact_1']) ? $branch['contact_1'] : '' ?>" required maxlength="16" minlength="5">
</div>
<div class="form-group col-md-6">
<label for="inputAddress" class="col-form-label">Contact 2</label>
<input type="text" class="form-control" name="contact_2" placeholder="Contact 2" value="<?= isset($branch['contact_2']) ? $branch['contact_2'] : '' ?>" required maxlength="10" minlength="10">
<input type="text" class="form-control" name="contact_2" placeholder="Contact 2" value="<?= isset($branch['contact_2']) ? $branch['contact_2'] : '' ?>" required maxlength="16" minlength="5">
</div>
</div>
<div class="form-row">
@ -93,4 +93,16 @@
</div>
</div>
</div>
<script>
$('#branch_add_form').submit(function(event) {
event.preventDefault();
// $('#branch_add_form').submit(); // This will submit the form
});
</script>
<?php include('layout/footer.php'); ?>

View File

@ -1,4 +1,6 @@
<?php include('layout/header.php'); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<div class="container-fluid">
<div class="row">
<div class="col-12">
@ -6,7 +8,7 @@
<h4 class="page-title">Branch List - <?php echo $business_name;?></h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class=""> <a href="#" data-toggle="modal" data-target="#bike_make_login-modal" class="btn btn-primary waves-effect">
<li class=""> <a href="#" id="add_branch_model_open" data-toggle="modal" data-target="#bike_make_login-modal" class="btn btn-primary waves-effect">
Add Branch
</a>
</ol>
@ -98,7 +100,7 @@
<div class="col-md-6">
<div class="form-group">
<label for="gstno">GST No</label>
<input class="form-control" name="gst_no" type="text" id="gst_no" required="" placeholder="GST No">
<input class="form-control" name="gst_no" type="text" id="gst_no" required="" placeholder="GST No" pattern="[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[0-9]{1}[Z]{1}[0-9A-Z]{1}">
</div>
</div>
<div class="col-md-6">
@ -110,13 +112,13 @@
<div class="col-md-6">
<div class="form-group">
<label for="contact1">Contact 1</label>
<input class="form-control" name="contact_1" type="text" id="contact_1" required="" placeholder="Contact 1">
<input class="form-control" name="contact_1" type="text" id="contact_1" required="" minlength="6" maxlength="16" placeholder="Contact 1">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="contact2">Contact 2</label>
<input class="form-control" name="contact_2" type="text" id="contact_2" required="" placeholder="Contact 2">
<input class="form-control" name="contact_2" type="text" id="contact_2" required="" minlength="6" maxlength="16" placeholder="Contact 2">
</div>
</div>
</div>
@ -192,7 +194,7 @@
};
var form = $(params).parent().parent();
// console.log(form);
var isValid = true;
form[0].querySelectorAll('[required]').forEach(function(element) {
if (!element.value.trim()) {
@ -249,6 +251,11 @@
}
});
}
$('#add_branch_model_open').click( function(){
$('#model_form_data')[0].reset();
})
</script>
<?php include('layout/footer.php'); ?>

View File

@ -25,13 +25,13 @@
<tr>
<th>#</th>
<th>Business Name</th>
<th>Email</th>
<th>Mobile</th>
<!-- <th>Email</th> -->
<!-- <th>Mobile</th> -->
<!-- <th style="width:10% !important">Address</th> -->
<th>City</th>
<th>State</th>
<th>Postal Code</th>
<th>Country</th>
<!-- <th>City</th> -->
<!-- <th>State</th> -->
<!-- <th>Postal Code</th> -->
<!-- <th>Country</th> -->
<th>Branch List</th>
<th>Action</th>
</tr>
@ -44,13 +44,13 @@
<tr>
<td><?= $value['business_id']; ?></td>
<td><?= $value['business_name']; ?></td>
<td><?= $value['email']; ?></td>
<td><?= $value['mobile']; ?></td>
<!-- <td ><?= $value['address']; ?></td> -->
<td><?= $value['city']; ?></td>
<td><?= $value['state']; ?></td>
<td><?= $value['postal_code']; ?></td>
<td><?= $value['country']; ?></td>
<?php if(isset($value['email'])) { ?><td><?= $value['email']; ?></td> <?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['mobile']; ?></td><?php } ?>
<?php if(isset($value['email'])) { ?><td ><?= $value['address']; ?></td> <?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['city']; ?></td><?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['state']; ?></td><?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['postal_code']; ?></td><?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['country']; ?></td><?php } ?>
<!-- Call the model method -->
<td> <a href="<?= base_url("branch_index/" . $value['business_id']) ?>" style="margin-left: 20px;">View</a></td>
<td>

View File

@ -24,7 +24,7 @@
</div>
<div class="form-group col-md-4">
<label for="inputAddress" class="col-form-label">Mobile<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="mobile" placeholder="Mobile" value="<?= isset($client['mobile_no']) ? $client['mobile_no'] : '' ?>" maxlength="10" minlength="10" onkeypress = "return onlyNumbers(event)" required/>
<input type="text" class="form-control" name="mobile" placeholder="Mobile" value="<?= isset($client['mobile_no']) ? $client['mobile_no'] : '' ?>" maxlength="16" minlength="6" onkeypress = "return onlyNumbers(event)" required/>
</div>
<div class="form-group col-md-4">
<label for="inputPassword4" class="col-form-label">Client Type<span class="text-danger">*</span></label>

View File

@ -60,7 +60,7 @@
</div>
<div class="form-group col-md-3">
<label for="inputPassword4" class="col-form-label">Mobile No<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($jobs['client_mobile_no']) ? $jobs['client_mobile_no'] : '' ?>" maxlength="10" minlength="10" onkeypress = "return onlyNumbers(event)" readonly>
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($jobs['client_mobile_no']) ? $jobs['client_mobile_no'] : '' ?>" maxlength="16" minlength="6" onkeypress = "return onlyNumbers(event)" readonly>
</div>
</div><br>
<h4 class="header-title">Billing Address Details :</h4><br>
@ -182,7 +182,7 @@
<h4><i class="fa fa-plus" aria-hidden="true" style="margin-right: 5px;"></i>Complaint</h4>
</a>
<a class="btn" id="addCustomComplaint">
<h4><i class="fa fa-plus" aria-hidden="true" style="margin-right: 5px;"></i>Custom Complaint</h4>
<h4><i class="fa fa-plus" aria-hidden="true" style="margin-right: 5px;"></i>Customer Complaint</h4>
</a>
<a class="btn" id="addOutsource">
<h4><i class="fa fa-plus" aria-hidden="true" style="margin-right: 5px;"></i>Outsource</h4>
@ -299,7 +299,7 @@
<div class="form-group col-md-12 select">
<label for="clientMobile">Mobile</label>
<input type="text" class="form-control client_mob_no" id="clientMobile" placeholder="Enter mobile number" maxlength="10" minlength="10"onkeypress = "return onlyNumbers(event)"required>
<input type="text" class="form-control client_mob_no" id="clientMobile" placeholder="Enter mobile number" maxlength="16" minlength="6"onkeypress = "return onlyNumbers(event)"required>
</div>
@ -313,7 +313,7 @@
<div class="form-group col-md-6 create" style="display:none;">
<label for="create-clientMobile">Mobile</label>
<input type="text" class="form-control" id="create-clientMobile" placeholder="Enter mobile number" maxlength="10" minlength="10"onkeypress = "return onlyNumbers(event)"required>
<input type="text" class="form-control" id="create-clientMobile" placeholder="Enter mobile number" maxlength="16" minlength="6"onkeypress = "return onlyNumbers(event)"required>
</div>
<div class="form-group col-md-6 create" style="display:none;">
@ -664,20 +664,20 @@ $(document).ready(function() {
}
});
$(window).on('load', function() {
// This code will execute after the page has been reloaded
vehicle_id = localStorage.getItem('vehicle_id');
if(vehicle_id) {
fetch_data(vehicle_id);
$('#vehicle_name').val(vehicle_id);
var vehicleId = vehicle_id;
$(window).on('load', function() {
// This code will execute after the page has been reloaded
vehicle_id = localStorage.getItem('vehicle_id');
localStorage.removeItem('vehicle_id');
if(vehicle_id) {
fetch_data(vehicle_id);
var vehicleId = vehicle_id;
if (vehicleId !== '') {
// Find the selected client in the client data
var selectedClient = vehicles.find(function(vehicle) {
return vehicle.vehicle_id == vehicleId;
});
console.log(selectedClient);
console.log(selectedClient);
$('input[name="client_id"]').val(selectedClient.client_name);
$('input[name="billing_address"]').val(selectedClient.address);
@ -688,9 +688,11 @@ $(window).on('load', function() {
$('input[name="mobile_no"]').val(selectedClient.mobile_no);
$('input[name="postalcode"]').val(selectedClient.postal_code);
}
}
localStorage.removeItem('vehicle_id');
});
$('#vehicle_name').val(vehicle_id).trigger('change');
}
});
productarray = [];
servicearray = [];
@ -717,7 +719,7 @@ $(window).on('load', function() {
// Extract makeId from the selected vehicle
var makeId = selectedVehicle.make;
var modelId = selectedVehicle.model;
// console.log(modelId);
// console.log(modelId);
// Make sure makeId exists
if (makeId !== undefined) {
@ -753,7 +755,6 @@ $(window).on('load', function() {
vehicle_id: vehicleId
},
success: function(response) {
console.log("111111111111111111");
console.log(response);
servicearray = response.service;
makeAndModel = response.makeName+' '+response.modelName;
@ -2009,114 +2010,101 @@ $closestTR.remove();
<script>
$(document).ready(function() {
// AJAX request to save client
$('#saveVehcileBtn').click(function() {
// AJAX request to save client
$('#saveVehcileBtn').click(function() {
var formType = $('#formType').val();
console.log(formType);
var formType = $('#formType').val();
var reg_no = $('#reg_no').val();
var model = $('#model').val();
var make = $('#make').val();
var reg_no = $('#reg_no').val();
var model = $('#model').val();
var make = $('#make').val();
var clientName = $('#clientName').val();
var clientMobile = $('#clientMobile').val();
var clientName = $('#clientName').val();
var clientMobile = $('#clientMobile').val();
var createclientName = $('#create-clientName').val();
var createclientMobile = $('#create-clientMobile').val();
var createclientType = $('#create-clientType').val();
var createclientName = $('#create-clientName').val();
var createclientMobile = $('#create-clientMobile').val();
var createclientType = $('#create-clientType').val();
if (formType == 'select')
{
var ifStatementCondition = "clientName !== '' && clientMobile !== '' && reg_no !== '' && model !== '' && make !== ''";
} else {
var ifStatementCondition = "createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
}
if(createclientMobile) {
var clientArray = <?php echo json_encode($client) ?>;
console.log(clientArray);
var mobileIdExists = clientArray.some(function(client) {
return client.mobile_no.trim() === createclientMobile.trim();
});
if(mobileIdExists) {
toastr.warning("Mobile Number Already Added!");
return;
if (formType == 'select')
{
var ifStatementCondition = "clientName !== '' && clientMobile !== '' && reg_no !== '' && model !== '' && make !== ''";
} else {
var ifStatementCondition = "createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
}
}
if (reg_no) {
$('#saveVehcileBtn').prop('disabled', true);
$.ajax({
url: '<?= base_url("checkRegisterNo") ?>', // URL to your controller method for fetching models
type: 'POST',
dataType: 'json',
data: { register_number: reg_no },
success: function(response) {
if (response) {
$('#reg_no').val("");
toastr.warning("Register Number Already Added!");
$('#saveVehcileBtn').prop('disabled', false);
}else{
if( eval(ifStatementCondition) ){
if(createclientMobile) {
var clientArray = <?php echo json_encode($client) ?>;
console.log(clientArray);
var mobileIdExists = clientArray.some(function(client) {
return client.mobile_no.trim() === createclientMobile.trim();
});
// Send AJAX request to save the client
$.ajax({
url: '<?php echo base_url().'save_vehicle'?>', // URL to your save_client method
method: 'POST',
data: {
client_id: clientName,
mobile_no: clientMobile,
reg_no:reg_no,
model:model,
make:make,
createclientName:createclientName,
createclientMobile:createclientMobile,
createclientType:createclientType,
formType:formType,
if(mobileIdExists) {
toastr.warning("Mobile Number Already Added!");
return;
}
}
if (reg_no) {
$('#saveVehcileBtn').prop('disabled', true);
$.ajax({
url: '<?= base_url("checkRegisterNo") ?>', // URL to your controller method for fetching models
type: 'POST',
dataType: 'json',
data: { register_number: reg_no },
success: function(response) {console.log("1111111111");
console.log(response);
if (response) {
$('#reg_no').val("");
toastr.warning("Register Number Already Added!");
$('#saveVehcileBtn').prop('disabled', false);
}else{
if( eval(ifStatementCondition) ){
},
success: function(response) {
if (response.success) {
$('#addVehicleModal').modal('hide');
toastr.success("Vehicle saved successfully!");
localStorage.setItem('vehicle_id',response.vehicle_id)
// window.location.reload();
} else {
toastr.warning("Failed to save vehicle. Please try again");
// Send AJAX request to save the client
$.ajax({
url: '<?php echo base_url().'save_vehicle'?>', // URL to your save_client method
method: 'POST',
data: {
client_id: clientName,
mobile_no: clientMobile,
reg_no:reg_no,
model:model,
make:make,
createclientName:createclientName,
createclientMobile:createclientMobile,
createclientType:createclientType,
formType:formType,
},
success: function(response) {
if (response.success) {
$('#addVehicleModal').modal('hide');
toastr.success("Vehicle saved successfully!");
localStorage.setItem('vehicle_id',response.vehicle_id)
window.location.reload();
} else {
toastr.warning("Failed to save vehicle. Please try again");
$('#saveVehcileBtn').prop('disabled', false);
}
},
error: function(xhr, status, error) {
console.error('Error occurred while saving vehicle:', error);
toastr.warning("Failed to save vehicle. Please try again");
$('#saveVehcileBtn').prop('disabled', false);
}
});
}else{
toastr.warning("Please Fill All Data");
$('#saveVehcileBtn').prop('disabled', false);
}
},
error: function(xhr, status, error) {
console.error('Error occurred while saving vehicle:', error);
toastr.warning("Failed to save vehicle. Please try again");
$('#saveVehcileBtn').prop('disabled', false);
}
});
}else{
toastr.warning("Please Fill All Data");
$('#saveVehcileBtn').prop('disabled', false);
}
}
},
error: function(xhr, status, error) {
console.error(error); // Log any errors to the console
}
},
error: function(xhr, status, error) {
console.error(error); // Log any errors to the console
}
});
}
});
});
}
});
});

View File

@ -209,13 +209,15 @@
</div>
<div class="form-group col-md-3" id="ml_div" <?= (isset($products['per']) && $products['per'] == 'ml') ? '' : 'hidden' ?> >
<label for="inputPassword4" class="col-form-label">ML<span class="text-danger">*</span></label>
<select name="ml" id="ml" class="form-control" <?= (isset($products['per']) && $products['per'] == 'ml') ? 'required' : '' ?>>
<option value <?= (isset($products['ml']) && $products['ml'] == 0) ? 'selected' : '' ?>>Slect ML</option>
<option value="50" <?= (isset($products['ml']) && $products['ml'] == 50) ? 'selected' : '' ?>>50</option>
<option value="100" <?= (isset($products['ml']) && $products['ml'] == 100) ? 'selected' : '' ?>>100</option>
<option value="250" <?= (isset($products['ml']) && $products['ml'] == 250) ? 'selected' : '' ?>>250</option>
<option value="500" <?= (isset($products['ml']) && $products['ml'] == 500) ? 'selected' : '' ?>>500</option>
<option value="750" <?= (isset($products['ml']) && $products['ml'] == 750) ? 'selected' : '' ?>>750</option>
<select name="ml" id="ml" class="form-control SelExample select2-hidden-accessible" <?= (isset($products['per']) && $products['per'] == 'ml') ? 'required' : '' ?>>
<option value>Select ML</option>
<?php
$selectedValue = isset($products['ml']) ? $products['ml'] : 0;
for ($i = 25; $i <= 750; $i += 25) {
$selected = ($selectedValue == $i) ? 'selected' : '';
echo "<option value=\"$i\" $selected>$i</option>";
}
?>
</select>
</div>
<div class="form-group col-md-3">
@ -239,8 +241,7 @@
<div class="form-row">
<div class="form-group col-md-12">
<label for="description" class="col-form-label">Description</label>
<textarea class="form-control" name="description" placeholder="Description"value="<?= isset($products['description']) ? $products['description'] : '' ?>" >
</textarea>
<textarea class="form-control" name="description" placeholder="Description"value="<?= isset($products['description']) ? $products['description'] : '' ?>" ></textarea>
</div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>

View File

@ -48,14 +48,14 @@
<table id="datatable-buttons2" class="table table-striped dt-responsive nowrap w-100"
style="width:100% !important;">
<thead>
<tr>
<td>
<tr >
<td style="border: none;">
<input class="form-control form-control-sm" type="text" id="searchSKUId" placeholder="Search SKU Id">
</td>
<td>
<td style="border: none;">
<input class="form-control form-control-sm" type="text" id="searchProductName" placeholder="Search Product Name">
</td>
<td>
<td style="border: none;">
<input class="form-control form-control-sm" type="text" id="searchManufacturerName" placeholder="Search Manufacturer Name">
</td>
<td>
@ -64,12 +64,12 @@
<td>
<input class="form-control form-control-sm" type="text" id="searchUnitPrice" placeholder="Search Unit Price">
</td>
<!-- <td>
<td>
<input class="form-control form-control-sm" type="text" id="searchQtyStock" placeholder="Search Qty in Stock">
</td>
<td>
<input class="form-control form-control-sm" type="text" id="searchRackNo" placeholder="Search Rack No">
</td> -->
</td>
</tr>
<tr>
<th>SKU Id</th>
@ -173,11 +173,31 @@
$(document).ready(function() {
// Event listener for input changes in search fields
$('input[type="text"]').on('input', function() {
var columnIndex = $(this).closest('td').index() + 1; // Get the index of the input field's parent td
var searchText = $(this).val().toLowerCase();
var searchTextSKU = $('#searchSKUId').val().toLowerCase();
var searchTextProductName = $('#searchProductName').val().toLowerCase();
var searchTextManufacturerName = $('#searchManufacturerName').val().toLowerCase();
var searchTextCategory = $('#searchCategory').val().toLowerCase();
var searchTextUnitPrice = $('#searchUnitPrice').val().toLowerCase();
var searchTextQtyStock = $('#searchQtyStock').val().toLowerCase();
var searchTextRackNo = $('#searchRackNo').val().toLowerCase();
$('#datatable-buttons2 tbody tr').each(function() {
var cellText = $(this).find('td:nth-child(' + columnIndex + ')').text().toLowerCase();
if (cellText.includes(searchText)) {
var cellTextSKU = $(this).find('td:nth-child(1)').text().toLowerCase();
var cellTextProductName = $(this).find('td:nth-child(2)').text().toLowerCase();
var cellTextManufacturerName = $(this).find('td:nth-child(3)').text().toLowerCase();
var cellTextCategory = $(this).find('td:nth-child(4)').text().toLowerCase();
var cellTextUnitPrice = $(this).find('td:nth-child(5)').text().toLowerCase();
var cellTextQtyStock = $(this).find('td:nth-child(6)').text().toLowerCase();
var cellTextRackNo = $(this).find('td:nth-child(7)').text().toLowerCase();
// Show the row if all search fields match
if (cellTextSKU.includes(searchTextSKU) &&
cellTextProductName.includes(searchTextProductName) &&
cellTextManufacturerName.includes(searchTextManufacturerName) &&
cellTextCategory.includes(searchTextCategory) &&
cellTextUnitPrice.includes(searchTextUnitPrice) &&
cellTextQtyStock.includes(searchTextQtyStock) &&
cellTextRackNo.includes(searchTextRackNo)) {
$(this).show();
} else {
$(this).hide();
@ -185,4 +205,5 @@
});
});
});
</script>
</script>

View File

@ -207,20 +207,16 @@
</div>
</div>
<h4 class="header-title">Terms & Condition :</h4><br>
<div class="form-row">
<div class="form-group col-md-12">
<label for="inputPassword4" class="col-form-label">Terms & Condition</label>
<textarea class="form-control" name="terms_condition" placeholder="Terms & Condition" ><?= isset($sales['terms_condition']) ? $sales['terms_condition'] : 'Please check the products properly before purchase. Products once sold cannot be returned.' ?></textarea>
</div>
</div>
<?php if (!isset($purchase['status']) || $purchase['status'] !== 'Received' || isset($reorder)) : ?>
<button type="submit" id="editaddbutton"class="btn btn-primary">Submit</button>
<?php endif; ?>
<!-- <h4 class="header-title">Terms & Condition :</h4><br>
<div class="form-row">
<div class="form-group col-md-12">
<label for="inputPassword4" class="col-form-label">Terms & Condition</label>
<textarea class="form-control" name="terms_condition" placeholder="Terms & Condition" ><?= isset($sales['terms_condition']) ? $sales['terms_condition'] : 'Please check the products properly before purchase. Products once sold cannot be returned.' ?></textarea>
</div>
</div> -->
<?php if (!isset($purchase['status']) || $purchase['status'] !== 'Received' || isset($reorder)) : ?>
<button type="submit" id="editaddbutton"class="btn btn-primary">Submit</button>
<?php endif; ?>
</form>
</div>
</div>

View File

@ -59,8 +59,8 @@
<label for="inputPassword4" class="col-form-label">Mobile No<span
class="text-danger">*</span></label>
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile"
value="<?= isset($sales['mobile_no']) ? $sales['mobile_no'] : '' ?>" maxlength="10"
minlength="10" onkeypress="return onlyNumbers(event)" readonly>
value="<?= isset($sales['mobile_no']) ? $sales['mobile_no'] : '' ?>" maxlength="16"
minlength="6" onkeypress="return onlyNumbers(event)" readonly>
</div>
<div class="form-group col-md-4">
<label for="inputPassword4" class="col-form-label">Status<span class="text-danger">*</span>
@ -379,7 +379,7 @@
<div class="form-group col-md-12 select">
<label for="clientMobile">Mobile</label>
<input type="text" class="form-control" id="clientMobile" placeholder="Enter mobile number"
maxlength="10" minlength="10" onkeypress="return onlyNumbers(event)" required>
maxlength="16" minlength="6" onkeypress="return onlyNumbers(event)" required>
</div>
@ -395,7 +395,7 @@
<div class="form-group col-md-6 create" style="display:none;">
<label for="create-clientMobile">Mobile</label>
<input type="text" class="form-control" id="create-clientMobile"
placeholder="Enter mobile number" maxlength="10" minlength="10"
placeholder="Enter mobile number" maxlength="16" minlength="6"
onkeypress="return onlyNumbers(event)" required>
</div>
@ -842,14 +842,11 @@ $(document).ready(function() {
var createclientType = $('#create-clientType').val();
if (formType == 'select') {
var ifStatementCondition =
"clientName !== '' && clientMobile !== '' && reg_no !== '' && model !== '' && make !== ''";
var ifStatementCondition ="clientName !== '' && clientMobile !== '' && reg_no !== '' && model !== '' && make !== ''";
} else {
var ifStatementCondition =
"createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
var ifStatementCondition ="createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
}
console.log(ifStatementCondition);
if (reg_no) {
$.ajax({
@ -884,6 +881,7 @@ $(document).ready(function() {
if (response.success) {
$('#addVehicleModal').modal('hide');
toastr.success("Vehicle saved successfully!");
localStorage.setItem('vehicle_id',response.vehicle_id)
window.location.reload();
} else {
@ -1040,4 +1038,36 @@ $(document).on('click', '#selectClient', function() {
const taxAmount = itemResult * taxValue / 100;
row.querySelector('[name="tax-amount[]"]').value = taxAmount; // Ensure two decimal places
}
$(window).on('load', function() {
// This code will execute after the page has been reloaded
vehicle_id = localStorage.getItem('vehicle_id');
localStorage.removeItem('vehicle_id');
if(vehicle_id) {
var vehicleId = vehicle_id;
if (vehicleId !== '') {
// Find the selected client in the client data
// var selectedClient = vehicles.find(function(vehicle) {
// return vehicle.vehicle_id == vehicleId;
// });
// console.log(selectedClient);
// $('input[name="client_id"]').val(selectedClient.client_name);
// $('input[name="billing_address"]').val(selectedClient.address);
// // $('input[name="billing_address"]').val(selectedClient.address);
// $('input[name="city"]').val(selectedClient.city);
// $('input[name="state"]').val(selectedClient.state);
// $('input[name="country"]').val(selectedClient.country);
// $('input[name="mobile_no"]').val(selectedClient.mobile_no);
// $('input[name="postalcode"]').val(selectedClient.postal_code);
}
$('#vehicle_id').val(vehicle_id).trigger('change');
}
});
</script>

View File

@ -71,9 +71,9 @@
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-6" id="service_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
<label for="model" class="col-form-label">Service</label>
<select class="form-control SelExample" id="serviceSelected" name="sub_service_id[]" multiple>
<select class="form-control SelExample" id="serviceSelected" name="sub_service_id[]" require multiple>
<option value="">Select a Service</option>
<?php foreach ($service as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?>
@ -284,18 +284,23 @@ document.getElementById('category').addEventListener('change', function() {
// var customFields = document.getElementById('customFields');
var makeSelect = document.getElementById('make');
var modelSelect = document.getElementById('model');
var serviceSelected = document.getElementById('serviceSelected');
if (this.value == '1') {
// customFields.style.display = 'block';
$('#make_hide').css('display' , 'block');
$('#model_hide').css('display' ,'block');
$('#service_hide').css('display' ,'block');
makeSelect.setAttribute('required', 'required');
modelSelect.setAttribute('required', 'required');
serviceSelected.setAttribute('required', 'required');
} else {
// customFields.style.display = 'none';
$('#make_hide').css('display' , 'none');
$('#model_hide').css('display' ,'none');
$('#service_hide').css('display' ,'none');
makeSelect.removeAttribute('required');
modelSelect.removeAttribute('required');
serviceSelected.removeAttribute('required');
$.ajax({
url: '<?php echo base_url('product_list_for_service') ?>', // URL to your CodeIgniter controller method

View File

@ -64,7 +64,7 @@
</div>
<div class="form-group col-md-6">
<label for="inputAddress" class="col-form-label">Mobile</label>
<input type="text" class="form-control" name="mobile" placeholder="Mobile" value="<?= isset($users['mobile_no']) ? $users['mobile_no'] : '' ?>" maxlength="10" minlength="10"required>
<input type="text" class="form-control" name="mobile" placeholder="Mobile" value="<?= isset($users['mobile_no']) ? $users['mobile_no'] : '' ?>" maxlength="16" minlength="6"required>
</div>
</div>
<input type="hidden" id="user_id" name="user_id" value="<?= isset($users['user_id']) ? $users['user_id'] : '' ?>">

View File

@ -82,7 +82,7 @@
</div>
<div class="form-group col-md-4">
<label for="inputAddress" class="col-form-label">Mobile<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="contact_person_mobile1" placeholder="Mobile" value="<?= isset($vendor['contact_person_mobile1']) ? $vendor['contact_person_mobile1'] : '' ?>" minlength="8" onkeypress = "return onlyNumbers(event)" required/>
<input type="text" class="form-control" name="contact_person_mobile1" placeholder="Mobile" value="<?= isset($vendor['contact_person_mobile1']) ? $vendor['contact_person_mobile1'] : '' ?>" minlength="6" maxlength="16" onkeypress = "return onlyNumbers(event)" required/>
</div>
<div class="form-group col-md-4">
<label for="inputAddress" class="col-form-label">Designation<span class="text-danger">*</span></label>
@ -96,7 +96,7 @@
</div>
<div class="form-group col-md-4">
<label for="inputAddress" class="col-form-label">Mobile</label>
<input type="text" class="form-control" name="contact_person_mobile2" placeholder="Mobile" value="<?= isset($vendor['contact_person_mobile2']) ? $vendor['contact_person_mobile2'] : '' ?>" minlength="8" onkeypress = "return onlyNumbers(event)" />
<input type="text" class="form-control" name="contact_person_mobile2" placeholder="Mobile" value="<?= isset($vendor['contact_person_mobile2']) ? $vendor['contact_person_mobile2'] : '' ?>" minlength="8" maxlength="16" onkeypress = "return onlyNumbers(event)" />
</div>
<div class="form-group col-md-4">
<label for="inputAddress" class="col-form-label">Designation</label>
@ -110,7 +110,7 @@
</div>
<div class="form-group col-md-4">
<label for="inputAddress" class="col-form-label">Mobile</label>
<input type="text" class="form-control" name="contact_person_mobile3" placeholder="Mobile" value="<?= isset($vendor['contact_person_mobile3']) ? $vendor['contact_person_mobile3'] : '' ?>" maxlength="10" minlength="10" onkeypress = "return onlyNumbers(event)" />
<input type="text" class="form-control" name="contact_person_mobile3" placeholder="Mobile" value="<?= isset($vendor['contact_person_mobile3']) ? $vendor['contact_person_mobile3'] : '' ?>" maxlength="16" minlength="6" onkeypress = "return onlyNumbers(event)" />
</div>
<div class="form-group col-md-4">
<label for="inputAddress" class="col-form-label">Designation</label>