fixup the Manufacturer and Model ddms and text inputs

This commit is contained in:
Isaac Connor 2021-09-25 20:48:43 -04:00
parent fe72056d73
commit d98d20958c
1 changed files with 25 additions and 15 deletions

View File

@ -457,27 +457,37 @@ switch ( $name ) {
</tr> </tr>
<tr class="Manufacturer"> <tr class="Manufacturer">
<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>
require_once('includes/Manufacturer.php'); <?php
$manufacturers = array_merge( require_once('includes/Manufacturer.php');
array(''=>translate('unknown')), $manufacturers = array(''=>translate('unknown'));
ZM\Manufacturer::find()); foreach ( ZM\Manufacturer::find( null, array('order'=>'lower(Name)')) as $Manufacturer ) {
echo htmlSelect('newMonitor[ManufacturerId]', $manufacturers, $monitor->ManufacturerId(), array('class'=>'chosen','data-on-change-this'=>'ManufacturerId_onchange')); $manufacturers[$Manufacturer->Id()] = $Manufacturer->Name();
}
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"/> <input type="text" name="newMonitor[Manufacturer]"
placeholder="enter new manufacturer name"
value="<?php echo $monitor->Manufacturer()->Name() ?>"<?php echo $monitor->ManufacturerId() ? ' 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>
require_once('includes/Model.php'); <?php
$models = array_merge( require_once('includes/Model.php');
array(''=>translate('unknown')), $models = array(''=>translate('unknown'));
ZM\Model::find(array('ManufacturerId'=>$monitor->ManufacturerId())) foreach ( ZM\Model::find(array('ManufacturerId'=>$monitor->ManufacturerId()), array('order'=>'lower(Name)')) as $Model ) {
); $models[$Model->Id()] = $Model->Name();
echo htmlSelect('newMonitor[ModelId]', $models, $monitor->ModelId(), array('class'=>'chosen', 'data-on-change-this'=>'ModelId_onchange')); }
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"/> <input type="text" name="newMonitor[Model]"
placeholder="enter new model name"
value="<?php echo $monitor->Model()->Name() ?>"<?php echo $monitor->ModelId() ? ' style="display:none"':'' ?>/>
</td> </td>
</tr> </tr>
<tr> <tr>