Skip to content

Commit

Permalink
Fix reserved field
Browse files Browse the repository at this point in the history
  • Loading branch information
partydragen committed Feb 13, 2023
1 parent ef6758b commit 9ae864c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion upload/custom/panel_templates/Default/store/fields.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<td>
<div class="float-md-right">
<a class="btn btn-warning btn-sm" href="{$field.edit_link}"><i class="fas fa-edit fa-fw"></i></a>
{if $field.identifier != '{quantity}'}<button class="btn btn-danger btn-sm" type="button" onclick="showDeleteModal('{$field.delete_link}')"><i class="fas fa-trash fa-fw"></i></button>{else}<button class="btn btn-danger btn-sm" type="button"><i class="fa fa-lock fa-fw"></i></button>{/if}
{if !$field.reserved}<button class="btn btn-danger btn-sm" type="button" onclick="showDeleteModal('{$field.delete_link}')"><i class="fas fa-trash fa-fw"></i></button>{else}<button class="btn btn-danger btn-sm" type="button"><i class="fa fa-lock fa-fw"></i></button>{/if}
</div>
</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions upload/custom/panel_templates/Default/store/fields_form.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
<form role="form" action="" method="post">
<div class="form-group">
<label for="InputIdentifier">{$IDENTIFIER}</label>
<input type="text" name="identifier" class="form-control" id="InputIdentifier" placeholder="{$IDENTIFIER}" value="{$IDENTIFIER_VALUE}" {if $IDENTIFIER_VALUE == 'quantity'}disabled{/if}>
<input type="text" name="identifier" class="form-control" id="InputIdentifier" placeholder="{$IDENTIFIER}" value="{$IDENTIFIER_VALUE}" {if $RESERVED_FIELD}disabled{/if}>
</div>
<div class="form-group">
<label for="InputName">{$DESCRIPTION}</label>
<input type="text" name="description" class="form-control" id="InputDescription" placeholder="{$DESCRIPTION}" value="{$DESCRIPTION_VALUE}">
</div>
<div class="form-group">
<label for="type">{$TYPE}</label>
<select class="form-control" id="type" name="type" {if $IDENTIFIER_VALUE == 'quantity'}disabled{/if}>
<select class="form-control" id="type" name="type" {if $RESERVED_FIELD}disabled{/if}>
{foreach from=$TYPES item=type}
<option value="{$type.id}"{if $TYPE_VALUE eq {$type.id}} selected{/if}>{$type.name}</option>
{/foreach}
Expand All @@ -67,7 +67,7 @@
</div>
<div class="form-group">
<label for="InputOptions">{$OPTIONS} / {$CHECKBOX} / {$RADIO} - {$OPTIONS_HELP}</label>
<textarea rows="5" class="form-control" name="options" id="options" placeholder="{$OPTIONS} / {$CHECKBOX} / {$RADIO}" {if $IDENTIFIER_VALUE == 'quantity'}disabled{/if}>{$OPTIONS_VALUE}</textarea>
<textarea rows="5" class="form-control" name="options" id="options" placeholder="{$OPTIONS} / {$CHECKBOX} / {$RADIO}" {if $RESERVED_FIELD}disabled{/if}>{$OPTIONS_VALUE}</textarea>
</div>
<div class="row">
<div class="col-md-4">
Expand Down
2 changes: 2 additions & 0 deletions upload/modules/Store/pages/panel/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'description' => Output::getClean($field->description),
'type' => $field_types[$field->type]['name'],
'required' => Output::getClean($field->required),
'reserved' => ($field->identifier == 'quantity' || $field->identifier == 'price'),
'edit_link' => URL::build('/panel/store/fields/', 'action=edit&id='.$field->id),
'delete_link' => URL::build('/panel/store/fields/', 'action=delete&amp;id=' . $field->id)
];
Expand Down Expand Up @@ -292,6 +293,7 @@
'REGEX_VALUE' => Output::getClean($field->regex ?? ''),
'REQUIRED' => $language->get('admin', 'required'),
'REQUIRED_VALUE' => $field->required,
'RESERVED_FIELD' => ($field->identifier == 'quantity' || $field->identifier == 'price')
]);

$template_file = 'store/fields_form.tpl';
Expand Down

0 comments on commit 9ae864c

Please sign in to comment.