Removed default types

This commit is contained in:
MatteoGheza 2021-03-20 20:19:24 +00:00
parent 848c4aad96
commit f8b9fa560a
2 changed files with 6 additions and 3 deletions

View File

@ -422,8 +422,7 @@ CREATE TABLE `".$prefix."_bot_telegram` (
PRIMARY KEY (`id`),
KEY `Id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `".$prefix."_dbversion` (`version`, `timestamp`) VALUES('1', current_timestamp());
INSERT INTO `".$prefix."_type` (`id`, `name`) VALUES (NULL, 'type1'), (NULL, 'type2');"
INSERT INTO `".$prefix."_dbversion` (`version`, `timestamp`) VALUES('1', current_timestamp());"
);
} catch (Exception $e) {
if(is_cli()) {

View File

@ -104,6 +104,9 @@
{% for type in service.types %}
<option value='{{ type.name }}'>{{ type.name }}</option>
{% endfor %}
{% if service.types is empty %}
<option id="empty_option" value=''></option>
{% endif %}
<option value='add_new'>{{ 'Add type...'|t }}</option>
</select>
<br>
@ -115,6 +118,7 @@
</form>
<script>
$( ".types" ).change(function() {
$('#empty_option').remove();
var type = "";
$( ".types option:selected" ).each(function() {
type = $( this ).val();
@ -155,7 +159,7 @@
$( ".types option:selected" ).each(function() {
type = $( this ).val();
});
if(type == "add_new"){
if(type == "add_new" || type == ""){
toastr.error("{{ 'You must select a valid service type!'|t }}");
return false;
}