<label for="company_id" class="form-label"><?php echo lang("Localize.company") ?> <abbr title="Required field">*</abbr></label>
<?php if (isset($company_id) && !empty($company_id)) : ?>
    <select class="form-select select2" name="company_id" id="company_id">
        <option value="">None</option>
        <?php foreach ($companies as $company) : ?>

            <?php if ((!empty($company_id) && ($company->id == $company_id))) : ?>
                <option value="<?php echo $company->id ?>" selected><?php echo $company->name ?></option>
            <?php else : ?>
                <option value="<?php echo $company->id ?>"><?php echo $company->name ?></option>
            <?php endif ?>

        <?php endforeach ?>

    </select>
<?php else : ?>
    <select class="form-select select2" name="company_id" id="company_id" >
        <option value="">None</option>

        <?php foreach ($companies as $company) : ?>
            <option value="<?php echo $company->id ?>"><?php echo $company->name ?></option>
        <?php endforeach ?>
    </select>
<?php endif ?>