Update Untuk Kolom Active pada Tabel Product
This commit is contained in:
parent
1cbf604e8b
commit
6820de87e2
@ -581,7 +581,7 @@ class Activities extends Controller {
|
|||||||
FROM products p
|
FROM products p
|
||||||
LEFT JOIN productcatalog pc ON pc.`catalogid`=p.`catalogid`
|
LEFT JOIN productcatalog pc ON pc.`catalogid`=p.`catalogid`
|
||||||
LEFT JOIN producttype pt ON pt.`producttypeid`= pc.`producttypeid`
|
LEFT JOIN producttype pt ON pt.`producttypeid`= pc.`producttypeid`
|
||||||
WHERE p.siteid=$siteid and productaliasid<>0
|
WHERE p.siteid=$siteid and productaliasid<>0 and COALESCE(active, 1) = 1
|
||||||
ORDER BY FIELD(pt.producttypeid, 20, 19, 21, 12, 10, 14, 11, 13, 4, 3) DESC, pc.productname";
|
ORDER BY FIELD(pt.producttypeid, 20, 19, 21, 12, 10, 14, 11, 13, 4, 3) DESC, pc.productname";
|
||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
$results = $query->getResultArray();
|
$results = $query->getResultArray();
|
||||||
|
|||||||
@ -12,6 +12,7 @@ class Products extends BaseController {
|
|||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->data['productowners'] = array('S'=>'Summit', 'C'=> 'Customer', 'O' => 'Other');
|
$this->data['productowners'] = array('S'=>'Summit', 'C'=> 'Customer', 'O' => 'Other');
|
||||||
|
$this->data['productactives'] = array('1'=> 'Yes', '2'=>'No');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Data Dari CLQMS untuk MEAN Jumlah Test Selama 6 Bulan
|
// Get Data Dari CLQMS untuk MEAN Jumlah Test Selama 6 Bulan
|
||||||
@ -80,7 +81,7 @@ class Products extends BaseController {
|
|||||||
|
|
||||||
$where = 0;
|
$where = 0;
|
||||||
|
|
||||||
$sql = "SELECT p.productid, p.installationdate ,pc.productname, pc.productaliasid, p.productnumber, s.sitename, pt.producttypeid, pt.texts,
|
$sql = "SELECT p.productid, p.installationdate, p.active, pc.productname, pc.productaliasid, p.productnumber, s.sitename, pt.producttypeid, pt.texts,
|
||||||
z.zonename as city, z2.zonename as prov
|
z.zonename as city, z2.zonename as prov
|
||||||
FROM products p
|
FROM products p
|
||||||
left join productcatalog pc on pc.catalogid=p.catalogid
|
left join productcatalog pc on pc.catalogid=p.catalogid
|
||||||
@ -160,7 +161,6 @@ class Products extends BaseController {
|
|||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
$results = $query->getResultArray();
|
$results = $query->getResultArray();
|
||||||
$data['products_log'] = $results;
|
$data['products_log'] = $results;
|
||||||
|
|
||||||
|
|
||||||
return view('products_view', $data);
|
return view('products_view', $data);
|
||||||
}
|
}
|
||||||
@ -191,6 +191,7 @@ class Products extends BaseController {
|
|||||||
$data['productservice'] = $results;
|
$data['productservice'] = $results;
|
||||||
|
|
||||||
$data['productowners'] = $this->data['productowners'];
|
$data['productowners'] = $this->data['productowners'];
|
||||||
|
$data['productactives'] = $this->data['productactives'];
|
||||||
|
|
||||||
if ($this->request->getMethod() === 'POST') {
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
|
||||||
@ -211,17 +212,19 @@ class Products extends BaseController {
|
|||||||
'warrantystartdate' => ($this->request->getVar('warrantystartdate') == '') ? NULL : $this->request->getVar('warrantystartdate'),
|
'warrantystartdate' => ($this->request->getVar('warrantystartdate') == '') ? NULL : $this->request->getVar('warrantystartdate'),
|
||||||
'warrantyenddate' => ($this->request->getVar('warrantyenddate') == '') ? NULL : $this->request->getVar('warrantyenddate'),
|
'warrantyenddate' => ($this->request->getVar('warrantyenddate') == '') ? NULL : $this->request->getVar('warrantyenddate'),
|
||||||
'productowner' => $this->request->getVar('productowner'),
|
'productowner' => $this->request->getVar('productowner'),
|
||||||
|
'active' => ($this->request->getVar('productactive') == '') ? NULL : $this->request->getVar('productactive'),
|
||||||
'productserviceid' => $this->request->getVar('productserviceid'),
|
'productserviceid' => $this->request->getVar('productserviceid'),
|
||||||
'statuspart' => $this->request->getVar('statuspart'),
|
'statuspart' => $this->request->getVar('statuspart'),
|
||||||
'remotetool' => $this->request->getVar('remotetool'),
|
'remotetool' => $this->request->getVar('remotetool'),
|
||||||
'remoteid' => $this->request->getVar('remoteid'),
|
'remoteid' => $this->request->getVar('remoteid'),
|
||||||
'remotepwd' => $this->request->getVar('remotepwd'),
|
'remotepwd' => $this->request->getVar('remotepwd'),
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach($data['new_value'] as $qkey => $qvalue) {
|
foreach($data['new_value'] as $qkey => $qvalue) {
|
||||||
if(empty( $qvalue ) ) { $data['new_value'][$qkey] = null; }
|
if(empty( $qvalue ) ) { $data['new_value'][$qkey] = null; }
|
||||||
else { $data['new_value'][$qkey] = $db->escapeString($qvalue); }
|
else { $data['new_value'][$qkey] = $db->escapeString($qvalue); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if($productid != 0) {
|
if($productid != 0) {
|
||||||
if($this->validate($rules)){
|
if($this->validate($rules)){
|
||||||
$productsModel = new ProductsModel();
|
$productsModel = new ProductsModel();
|
||||||
@ -432,8 +435,6 @@ class Products extends BaseController {
|
|||||||
'statuspart' => $this->request->getVar('statuspart')
|
'statuspart' => $this->request->getVar('statuspart')
|
||||||
];
|
];
|
||||||
|
|
||||||
// var_dump($data['new_value']);die();
|
|
||||||
|
|
||||||
$productsLogModel = new ProductsLogModel();
|
$productsLogModel = new ProductsLogModel();
|
||||||
$productsLogModel->update($productlogid, $data['new_value']);
|
$productsLogModel->update($productlogid, $data['new_value']);
|
||||||
return view('form_success');
|
return view('form_success');
|
||||||
@ -446,7 +447,6 @@ class Products extends BaseController {
|
|||||||
$productlogid = $this->request->getVar('logid');
|
$productlogid = $this->request->getVar('logid');
|
||||||
$sql = "delete from products_log where productlogid='$productlogid'";
|
$sql = "delete from products_log where productlogid='$productlogid'";
|
||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
//echo "$sql";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function exportdata() {
|
public function exportdata() {
|
||||||
|
|||||||
@ -7,6 +7,6 @@ class ProductsModel extends Model {
|
|||||||
protected $primaryKey = 'productid';
|
protected $primaryKey = 'productid';
|
||||||
protected $allowedFields = [ 'siteid', 'productnumber', 'productname', 'catalogid',
|
protected $allowedFields = [ 'siteid', 'productnumber', 'productname', 'catalogid',
|
||||||
'installationdate', 'locationstartdate', 'locationenddate', 'warrantystartdate', 'warrantyenddate',
|
'installationdate', 'locationstartdate', 'locationenddate', 'warrantystartdate', 'warrantyenddate',
|
||||||
'productowner', 'productserviceid', 'statuspart',
|
'productowner', 'productserviceid', 'statuspart', 'active',
|
||||||
'remotetool', 'remoteid', 'remotepwd', 'createdate', 'enddate' ];
|
'remotetool', 'remoteid', 'remotepwd', 'createdate', 'enddate' ];
|
||||||
}
|
}
|
||||||
@ -11,6 +11,7 @@ $installationdate = '';
|
|||||||
$warrantystartdate = '';
|
$warrantystartdate = '';
|
||||||
$warrantyenddate = '';
|
$warrantyenddate = '';
|
||||||
$productowner = '';
|
$productowner = '';
|
||||||
|
$productactive = '';
|
||||||
$statusservice = '';
|
$statusservice = '';
|
||||||
$statuspart = '';
|
$statuspart = '';
|
||||||
$remotetool = '';
|
$remotetool = '';
|
||||||
@ -29,10 +30,12 @@ if(isset($data)) {
|
|||||||
$warrantystartdate = $data['warrantystartdate'];
|
$warrantystartdate = $data['warrantystartdate'];
|
||||||
$warrantyenddate = $data['warrantyenddate'];
|
$warrantyenddate = $data['warrantyenddate'];
|
||||||
$productowner = $data['productowner'];
|
$productowner = $data['productowner'];
|
||||||
|
$productactive = ($data['active'] == NULL) ? '1' : $data['active'];
|
||||||
$remotetool = $data['remotetool'];
|
$remotetool = $data['remotetool'];
|
||||||
$remoteid = $data['remoteid'];
|
$remoteid = $data['remoteid'];
|
||||||
$remotepwd = $data['remotepwd'];
|
$remotepwd = $data['remotepwd'];
|
||||||
$productserviceid = $data['productserviceid'];
|
$productserviceid = $data['productserviceid'];
|
||||||
|
// var_dump($productactive);die();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -43,12 +46,10 @@ if(isset($data)) {
|
|||||||
<?php
|
<?php
|
||||||
if(isset($validation)) {
|
if(isset($validation)) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class='alert alert-danger alert-dismissible'>
|
<div class='alert alert-danger alert-dismissible'>
|
||||||
<?= $validation->listErrors(); ?>
|
<?= $validation->listErrors(); ?>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -140,6 +141,20 @@ if(isset($data)) {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-3 col-form-label">Active Status</label>
|
||||||
|
<div class="col-9">
|
||||||
|
<select class='form-control' name='productactive'>
|
||||||
|
<option value=''></option>
|
||||||
|
<?php
|
||||||
|
foreach($productactives as $qactive => $qname) {
|
||||||
|
if($qactive == $productactive) { echo "<option value='$qactive' selected>$qname</option>"; }
|
||||||
|
else { echo "<option value='$qactive'>$qname</option>"; }
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-3 col-form-label">Status Part</label>
|
<label class="col-3 col-form-label">Status Part</label>
|
||||||
<div class="col-9"><input class="form-control" type="text" name='statuspart' value="<?=$statuspart;?>"></div>
|
<div class="col-9"><input class="form-control" type="text" name='statuspart' value="<?=$statuspart;?>"></div>
|
||||||
|
|||||||
@ -120,12 +120,18 @@ if(!isset($sitename)) { $sitename=''; }
|
|||||||
$date = new DateTime($installationdate);
|
$date = new DateTime($installationdate);
|
||||||
$installationdate = $date->format('M d, Y');
|
$installationdate = $date->format('M d, Y');
|
||||||
} else { $installationdate = ''; }
|
} else { $installationdate = ''; }
|
||||||
|
|
||||||
|
if ($data['active'] == '2') {
|
||||||
|
$bg='bg-danger';
|
||||||
|
} else {
|
||||||
|
$bg='';
|
||||||
|
}
|
||||||
|
|
||||||
/* if( $data['createdate'] != '' ) {
|
/* if( $data['createdate'] != '' ) {
|
||||||
$createdate = date('d-m-Y', strtotime($data['createdate']));
|
$createdate = date('d-m-Y', strtotime($data['createdate']));
|
||||||
} else { $createdate = ''; } */
|
} else { $createdate = ''; } */
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr class='<?php echo($bg); ?>'>
|
||||||
<td><?=$productid;?></td>
|
<td><?=$productid;?></td>
|
||||||
<td><?=$sitename;?></td>
|
<td><?=$sitename;?></td>
|
||||||
<td><?=$prov;?></td>
|
<td><?=$prov;?></td>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user