add Manufacturer and Model dropdown/text inputs to monitor edit view

This commit is contained in:
Isaac Connor 2021-07-07 09:47:55 -04:00
parent 54f676a501
commit 4ff4e1f780
1 changed files with 11 additions and 4 deletions

View File

@ -492,18 +492,25 @@ switch ( $name ) {
<td class="text-right pr-3"><?php echo translate('Manufacturer') ?></td> <td class="text-right pr-3"><?php echo translate('Manufacturer') ?></td>
<td><?php <td><?php
require_once('includes/Manufacturer.php'); require_once('includes/Manufacturer.php');
$manufacturers = ZM\Manufacturer::find(); $manufacturers = array_merge(
echo htmlSelect('newMonitor[ManufacturerId]', $manufacturers, $monitor->ManufacturerId(), array('class'=>'chosen')); array(''=>translate('unknown')),
ZM\Manufacturer::find());
echo htmlSelect('newMonitor[ManufacturerId]', $manufacturers, $monitor->ManufacturerId(), array('class'=>'chosen','data-on-change-this'=>'ManufacturerId_onchange'));
?> ?>
<input type="text" name="newMonitor[Manufacturer]" value="<?php echo $monitor->Manufacturer()->Name() ?>" style="display:none"/>
</td> </td>
</tr> </tr>
<tr class="Model"> <tr class="Model">
<td class="text-right pr-3"><?php echo translate('Model') ?></td> <td class="text-right pr-3"><?php echo translate('Model') ?></td>
<td><?php <td><?php
require_once('includes/Model.php'); require_once('includes/Model.php');
$models = ZM\Model::find(array('ManufacturerId'=>$monitor->ManufacturerId())); $models = array_merge(
echo htmlSelect('newMonitor[ModelId]', $models, $monitor->ModelId(), array('class'=>'chosen')); array(''=>translate('unknown')),
ZM\Model::find(array('ManufacturerId'=>$monitor->ManufacturerId()))
);
echo htmlSelect('newMonitor[ModelId]', $models, $monitor->ModelId(), array('class'=>'chosen', 'data-on-change-this'=>'ModelId_onchange'));
?> ?>
<input type="text" name="newMonitor[Model]" value="<?php echo $monitor->Model()->Name() ?>" style="display:none"/>
</td> </td>
</tr> </tr>
<tr> <tr>