Я хочу показать информацию о клиенте, когда я выбираю поле. Я помещаю в поле зрения выбор входа и, когда я выбираю выбрать любого клиента из поля выбора, перечисляя его информацию о недвижимости ниже. Как я могу это сделать?
Я показываю свои коды ниже:
Таблица недвижимости:
CREATE TABLE `estate` (
`estateId` int(11) NOT NULL AUTO_INCREMENT,
`estateType` int(11) DEFAULT NULL COMMENT 'mülk türü ev, villa v.b',
`estateCentare` varchar(6) COLLATE utf8_bin DEFAULT NULL,
`estateRoom` varchar(2) COLLATE utf8_bin DEFAULT NULL COMMENT 'adet',
`estateSalon` varchar(2) COLLATE utf8_bin DEFAULT NULL COMMENT 'adet',
`estateBathroom` varchar(2) COLLATE utf8_bin DEFAULT NULL COMMENT 'adet',
`estateHeating` int(11) DEFAULT NULL COMMENT 'ısıtma turu tablosu',
`estateCity` int(11) DEFAULT NULL COMMENT 'city Tablosu',
`estateAddress` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`estateCoord` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`estateGarden` tinyint(1) DEFAULT NULL COMMENT 'evin bahçesi var yok',
`estateBalcony` tinyint(1) DEFAULT NULL COMMENT 'balkon adet',
`estatePackage` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`estatePackageDate` datetime DEFAULT NULL,
`estatePackageUser` int(11) DEFAULT NULL,
`estateCreateDate` datetime DEFAULT NULL,
`estateCreateUser` int(11) DEFAULT NULL,
`estateEditDate` datetime DEFAULT NULL,
`estateEditUser` int(11) DEFAULT NULL,
`estateDue` decimal(5,0) DEFAULT NULL,
PRIMARY KEY (`estateId`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
cosId будет равен estateId при перечислении информации о его недвижимости.
Контроллер:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Property extends CI_Controller {
public function index()
{
$this->lang->load('content', $this->session->userdata('people_lang'));
$viewData = new stdClass();
$viewData->customers = $this->db->get("customer")->result();
$this->load->view('property', $viewData);
}
}
?>
Вид:
<section class="panel">
<header class="panel-heading">
PROPERTY / ESTATE
<span class="tools pull-right">
<a href="javascript:;" class="fa fa-chevron-down"></a>
<a href="javascript:;" class="fa fa-times"></a>
</span>
</header>
<div class="panel-body">
<h5>Property / Estate Management</h5>
<div class="form-group" hidden>
<label class="col-sm-2 col-sm-2 control-label">User Who Add:</label>
<div class="col-sm-10">
<input type="text" name="docFileCreateUser" class="form-control" value="<?php echo $this->session->userdata("people_id"); ?>" readonly>
</div>
</div>
<div class="form-group">
<div class="col-lg-12">
<h5 class=""><i class="fas fa-handshake"></i> Choose Customer:</h5>
<select class="js-example-basic-single" name="docFileDocType" required="required">
<option value="" readonly>Select</option>
<?php
foreach($customers as $customer){ if ($customer->cosStatus == 1) { ?>
<option value="<?php echo $customer->cusId; ?>"><?php echo $customer->cosCode; ?> <?php echo $customer->cosName. '' .$customer->cosSurname ?></option>
<?php } }?>
</select>
</div>
</div>
</div>
<div class="panel-body">
<div class="adv-table">
<h4><?php echo $customer->cosName.' '.$customer->cosSurname;?> | Information of Current Payments:</h4>
<div class="panel-body">
<section id="no-more-tables">
<table class="table table-bordered table-striped table-condensed cf" id="dynamic-table">
<thead class="cf">
<tr>
<th>File ID</th>
<th>Customer Code</th>
<th>Name Surname</th>
<th>File Type</th>
<th>Description</th>
<th>Create Date</th>
<th>File</th>
</tr>
</thead>
<tbody>
<?php
foreach($documents as $docs){ if(($customer->cusId) == ($docs->docFileCusId)){ ?>
<tr>
<td data-title="File ID"><?php echo $docs->docFileId; ?></</td>
<td data-title="Customer Code"><?php echo $customer->cosCode; ?></td>
<td data-title="Name Surname"><?php echo $customer->cosName.' '.$customer->cosSurname; ?></</td>
<td data-title="File Type"><?php echo $docs->docFileDocType; ?></td>
<td data-title="Description"><?php echo $docs->docFileDesc; ?></td>
<td data-title="Create Date"><?php echo $docs->docFileCreateDate; ?></</td>
<td data-title="File"><a href="<?php echo base_url().'upload/file/customer/'.$docs->docFileDirectory;?>" download><?php echo $docs->docFileDirectory; ?></a> <i class="fa fa-download"></i></td>
</tr>
<?php } } ?>
</tbody>
</table>
</section>
</div>
</div>
</div>
</section>