table name changes : ps
This commit is contained in:
parent
d1fe31630c
commit
2b1526b886
@ -20,10 +20,10 @@ class Complaint extends BaseController
|
|||||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||||
$ComplaintModel = new ComplaintModel();
|
$ComplaintModel = new ComplaintModel();
|
||||||
$complaint = $ComplaintModel->findAll();
|
$complaint = $ComplaintModel->findAll();
|
||||||
$cubiccentimeter = $ComplaintModel->getCubicCentimeterName();
|
$cubiccapacity = $ComplaintModel->getCubicCapacityName();
|
||||||
|
|
||||||
$data['complaint']=$complaint;
|
$data['complaint']=$complaint;
|
||||||
$data['cubiccentimeter']=$cubiccentimeter;
|
$data['cubiccapacity']=$cubiccapacity;
|
||||||
return view('complaint_list',$data);
|
return view('complaint_list',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,13 +32,13 @@ class Complaint extends BaseController
|
|||||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||||
try {
|
try {
|
||||||
$name = $this->request->getPost('name');
|
$name = $this->request->getPost('name');
|
||||||
$cubic_centimeter_id = $this->request->getPost('cubic_centimeter_id');
|
$cubic_capacity_id = $this->request->getPost('cubic_capacity_id');
|
||||||
// echo $cubic_centimeter_id; die;
|
// echo $cubic_capacity_id; die;
|
||||||
$ComplaintModel = new ComplaintModel();
|
$ComplaintModel = new ComplaintModel();
|
||||||
$conditions = ['name' => $name, 'isactive' => 1];
|
$conditions = ['name' => $name, 'isactive' => 1];
|
||||||
|
|
||||||
if ($cubic_centimeter_id) {
|
if ($cubic_capacity_id) {
|
||||||
$conditions['cubic_centimeter_id'] = $cubic_centimeter_id;
|
$conditions['cubic_capacity_id'] = $cubic_capacity_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($complaint_id > 0) {
|
if ($complaint_id > 0) {
|
||||||
@ -59,7 +59,7 @@ class Complaint extends BaseController
|
|||||||
"cgst" => $this->request->getPost('tax')/2,
|
"cgst" => $this->request->getPost('tax')/2,
|
||||||
"sgst" => $this->request->getPost('tax')/2,
|
"sgst" => $this->request->getPost('tax')/2,
|
||||||
"tax" => $this->request->getPost('tax'),
|
"tax" => $this->request->getPost('tax'),
|
||||||
"cubic_centimeter_id" => $this->request->getPost('cubic_centimeter_id') ? $this->request->getPost('cubic_centimeter_id') : 0,
|
"cubic_capacity_id" => $this->request->getPost('cubic_capacity_id') ? $this->request->getPost('cubic_capacity_id') : 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!$complaint_id) {
|
if (!$complaint_id) {
|
||||||
|
|||||||
@ -5,13 +5,13 @@ class ComplaintModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'complaints';
|
protected $table = 'complaints';
|
||||||
protected $primaryKey = 'complaint_id';
|
protected $primaryKey = 'complaint_id';
|
||||||
protected $allowedFields = ['complaint_id','business_id','name','labour_charge','cgst','sgst','tax','labour_cost_with_tax','isactive','cubic_centimeter_id'];
|
protected $allowedFields = ['complaint_id','business_id','name','labour_charge','cgst','sgst','tax','labour_cost_with_tax','isactive','cubic_capacity_id'];
|
||||||
|
|
||||||
public function getCubicCentimeterName()
|
public function getCubiccapacityName()
|
||||||
{
|
{
|
||||||
return $this->db->table('cubic_centimeter')
|
return $this->db->table('cubic_capacity')
|
||||||
->select('cubic_centimeter.*')
|
->select('cubic_capacity.*')
|
||||||
->where('cubic_centimeter.isactive', 1)
|
->where('cubic_capacity.isactive', 1)
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,16 +33,16 @@
|
|||||||
if($value['isactive'] == 0){
|
if($value['isactive'] == 0){
|
||||||
$color ='red';
|
$color ='red';
|
||||||
}
|
}
|
||||||
$cubiccentimeter_name = ''; // Default to empty if no match
|
$cubiccapacity_name = ''; // Default to empty if no match
|
||||||
// Loop through $cubiccentimeter to find a match
|
// Loop through $cubiccapacity to find a match
|
||||||
foreach ($cubiccentimeter as $cc) {
|
foreach ($cubiccapacity as $cc) {
|
||||||
if ($cc['id'] == $value['cubic_centimeter_id']) {
|
if ($cc['id'] == $value['cubic_capacity_id']) {
|
||||||
$cubiccentimeter_name = ' ( '.$cc['value'].' )'; // Get the name of the matching cubiccentimeter
|
$cubiccapacity_name = ' ( '.$cc['value'].' )'; // Get the name of the matching cubiccapacity
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr class="complaint_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" > <td><?= $value['name'].$cubiccentimeter_name;; ?></td>
|
<tr class="complaint_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" > <td><?= $value['name'].$cubiccapacity_name;; ?></td>
|
||||||
<td><?= $value['labour_cost_with_tax'] ?></td>
|
<td><?= $value['labour_cost_with_tax'] ?></td>
|
||||||
<td><?= $value['tax']; ?></td>
|
<td><?= $value['tax']; ?></td>
|
||||||
<td><?= $value['labour_charge']; ?></td>
|
<td><?= $value['labour_charge']; ?></td>
|
||||||
@ -91,10 +91,10 @@
|
|||||||
<input class="form-control" type="text" id="name" required="" placeholder="Complaint">
|
<input class="form-control" type="text" id="name" required="" placeholder="Complaint">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="cubic_centimeter">Cubic Centimeter</label>
|
<label for="cubic_capacity">Cubic capacity</label>
|
||||||
<select class="form-control" id="cubic_centimeter" name="cubic_centimeter" required data-toggle="select2">
|
<select class="form-control" id="cubic_capacity" name="cubic_capacity" required data-toggle="select2">
|
||||||
<option value="0">Select Cubic Centimeter</option>
|
<option value="0">Select Cubic capacity</option>
|
||||||
<?php foreach ($cubiccentimeter as $item): ?>
|
<?php foreach ($cubiccapacity as $item): ?>
|
||||||
<option value="<?= $item['id'] ?>"><?= $item['value'] ?></option>
|
<option value="<?= $item['id'] ?>"><?= $item['value'] ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
@ -142,19 +142,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submitComplaint(params) {
|
function submitComplaint(params) {
|
||||||
// console.log(':)',$('#cubic_centimeter_id').val());return false;
|
// console.log(':)',$('#cubic_capacity_id').val());return false;
|
||||||
if (!$('#name').val() || !$('#labour_charge').val()) {
|
if (!$('#name').val() || !$('#labour_charge').val()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log($('#cubic_centimeter_id').val());
|
console.log($('#cubic_capacity_id').val());
|
||||||
var tax = parseFloat($("#tax").val());
|
var tax = parseFloat($("#tax").val());
|
||||||
var labour_cost_with_tax = parseFloat($("#labour_cost_with_tax").val());
|
var labour_cost_with_tax = parseFloat($("#labour_cost_with_tax").val());
|
||||||
if(labour_cost_with_tax == '' || tax == ''){
|
if(labour_cost_with_tax == '' || tax == ''){
|
||||||
toastr.warning('Please select Tax', 'Warning');
|
toastr.warning('Please select Tax', 'Warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if($(!'#cubic_centimeter').val()){
|
// if($(!'#cubic_capacity').val()){
|
||||||
// toastr.warning('Please select Cubic Centimeter', 'Warning');
|
// toastr.warning('Please select Cubic capacity', 'Warning');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -163,7 +163,7 @@
|
|||||||
labour_charge: $('#labour_charge').val(),
|
labour_charge: $('#labour_charge').val(),
|
||||||
tax: tax,
|
tax: tax,
|
||||||
labour_cost_with_tax: labour_cost_with_tax,
|
labour_cost_with_tax: labour_cost_with_tax,
|
||||||
cubic_centimeter_id: $('#cubic_centimeter').val(),
|
cubic_capacity_id: $('#cubic_capacity').val(),
|
||||||
};
|
};
|
||||||
var complaint_id = $('#complaint_id').val();
|
var complaint_id = $('#complaint_id').val();
|
||||||
if (!complaint_id) {
|
if (!complaint_id) {
|
||||||
@ -216,7 +216,7 @@
|
|||||||
$('#name').val(response.complaint[0].name);
|
$('#name').val(response.complaint[0].name);
|
||||||
$('#labour_charge').val(response.complaint[0].labour_charge);
|
$('#labour_charge').val(response.complaint[0].labour_charge);
|
||||||
$('#labour_cost_with_tax').val(response.complaint[0].labour_cost_with_tax);
|
$('#labour_cost_with_tax').val(response.complaint[0].labour_cost_with_tax);
|
||||||
var cc_id = response.complaint[0].cubic_centimeter_id;
|
var cc_id = response.complaint[0].cubic_capacity_id;
|
||||||
|
|
||||||
var tax = parseFloat(response.complaint[0].cgst) + parseFloat(response.complaint[0].sgst);
|
var tax = parseFloat(response.complaint[0].cgst) + parseFloat(response.complaint[0].sgst);
|
||||||
var selectElement = document.getElementById('tax');
|
var selectElement = document.getElementById('tax');
|
||||||
@ -227,7 +227,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var selectElementForCC = document.getElementById('cubic_centimeter');
|
var selectElementForCC = document.getElementById('cubic_capacity');
|
||||||
var ccOptions = selectElementForCC.options;
|
var ccOptions = selectElementForCC.options;
|
||||||
for (var j = 0; j < ccOptions.length; j++) {
|
for (var j = 0; j < ccOptions.length; j++) {
|
||||||
if (ccOptions[j].value === cc_id) {
|
if (ccOptions[j].value === cc_id) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user