add accountid_productowner

This commit is contained in:
mahdahar 2025-11-12 12:46:08 +07:00
parent 10c275ac2b
commit d255dabfcb
8 changed files with 87 additions and 6 deletions

1
.gitignore vendored
View File

@ -125,3 +125,4 @@ _modules/*
/results/
/phpunit*.xml
/public/.htaccess

View File

@ -259,6 +259,8 @@ $routes->group('', ['filter' => 'cors'], function($routes) {
// $routes->get('/api/getProductList', 'Api::getProductList');
$routes->get('/api/getProductAlias', 'Api::getProductAlias');
$routes->get('/api/getProductSites', 'Api::getProductSites');
$routes->get('/api/getProvinces', 'Api::getProvinces');
$routes->get('/api/getCities', 'Api::getCities');
//CLQMS
// $routes->get('/clqms', 'Clqms::index'); // for CLQMS Inst select

View File

@ -82,8 +82,9 @@ class Products extends BaseController {
$where = 0;
$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, a1.accountname
FROM products p
left join accounts a1 on a1.accountid=p.accountid_productowner
left join productcatalog pc on pc.catalogid=p.catalogid
left join producttype pt on pt.producttypeid=pc.producttypeid
left join sites s on s.siteid=p.siteid
@ -189,6 +190,11 @@ class Products extends BaseController {
$query = $db->query($sql);
$results = $query->getResultArray();
$data['productservice'] = $results;
$sql = "select * from accounts";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['accounts'] = $results;
$data['productowners'] = $this->data['productowners'];
$data['productactives'] = $this->data['productactives'];
@ -211,6 +217,7 @@ class Products extends BaseController {
'installationdate' => ($this->request->getVar('installationdate') == '') ? NULL : $this->request->getVar('installationdate'),
'warrantystartdate' => ($this->request->getVar('warrantystartdate') == '') ? NULL : $this->request->getVar('warrantystartdate'),
'warrantyenddate' => ($this->request->getVar('warrantyenddate') == '') ? NULL : $this->request->getVar('warrantyenddate'),
'accountid_productowner' => $this->request->getVar('accountid_productowner'),
'productowner' => $this->request->getVar('productowner'),
'active' => ($this->request->getVar('productactive') == '') ? NULL : $this->request->getVar('productactive'),
'productserviceid' => $this->request->getVar('productserviceid'),

View File

@ -1,8 +1,9 @@
<?php namespace App\Models;
<?php
namespace App\Models;
use CodeIgniter\Model;
class ZonesModel extends Model {
class AreasModel extends Model {
protected $table = 'areas';
protected $primaryKey = 'areaid';
protected $allowedFields = [ 'areatype', 'areaname', 'description' ];

View File

@ -18,6 +18,7 @@ $remotetool = '';
$remoteid = '';
$remotepwd = '';
$productserviceid = '';
$accountid_productowner = '';
if(isset($products)) { $data = $products[0]; }
if(isset($new_value)) { $data = $new_value; }
if(isset($data)) {
@ -35,6 +36,7 @@ if(isset($data)) {
$remoteid = $data['remoteid'];
$remotepwd = $data['remotepwd'];
$productserviceid = $data['productserviceid'];
$accountid_productowner = $data['accountid_productowner'];
// var_dump($productactive);die();
}
?>
@ -79,6 +81,23 @@ if(isset($data)) {
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label">Account Owner</label>
<div class="col-9">
<select class="form-control select2" name='accountid_productowner' >
<option value=''>-</option>
<?php
foreach ($accounts as $data) {
$qaccountid = $data['accountid'];
$qaccountname = $data['accountname'];
if ($qaccountid == $accountid_productowner) { echo "<option value='$qaccountid' selected>$qaccountname</option>"; }
else { echo "<option value='$qaccountid'>$qaccountname</option>"; }
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label">Site</label>
<div class="col-9">

View File

@ -102,7 +102,7 @@ if(!isset($sitename)) { $sitename=''; }
<div class="table-responsive">
<table id="myTable" class="table display table-striped border">
<thead class="text-center">
<th>ID</th> <th>Site</th> <th>Province</th> <th>Kab/Kota</th> <th>Product Name</th> <th>Install Date</th> <th>Monthly Production</th> <th>Action</th>
<th>ID</th> <th>Site (Owner)</th> <th>Province</th> <th>Kab/Kota</th> <th>Product Name</th> <th>Install Date</th> <th>Monthly Production</th> <th>Action</th>
</thead>
<tbody>
<?php
@ -112,6 +112,7 @@ if(!isset($sitename)) { $sitename=''; }
$productname = $data['productname'];
$productnumber = $data['productnumber'];
$productaliasid = $data['productaliasid'];
$accountname = $data['accountname'];
$city = $data['city'];
$prov = $data['prov'];
@ -133,7 +134,7 @@ if(!isset($sitename)) { $sitename=''; }
?>
<tr class='<?php echo($bg); ?>'>
<td><?=$productid;?></td>
<td><?=$sitename;?></td>
<td><?=$sitename;?> <br /> <?php if($accountname != '') { echo "($accountname)";}?></td>
<td><?=$prov;?></td>
<td><?=$city;?></td>
<td><?=$productname;?><?php if(isset($productnumber)) { echo "<br/>SN : $productnumber" ;} ?></td>

View File

@ -15,6 +15,7 @@ Options -Indexes
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
RewriteBase /crm/
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
@ -31,7 +32,7 @@ Options -Indexes
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .

49
public/htaccess Normal file
View File

@ -0,0 +1,49 @@
# Disable directory browsing
Options -Indexes
# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Rewrite "www.example.com -> example.com"
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
# Disable server signature start
ServerSignature Off
# Disable server signature end