<script type="text/javascript">
function manage_group(mode, value) {
	ajax.exec({
		action   : 'manage_group',
		mode     : mode,
		group_id : {GROUP_ID},
		value    : value
	});
	ajax.callback.manage_group = function(data) {
		if (data.act == 0) $('div#avatar').hide(100);
		console.log(data);
	}
}
</script>
  <script>
    $(function() {
      $('.custom-file').pxFile();
    });
  </script>
<div class="col-xl-12">
	<div class="page-header">
		<div class="box m-a-0 bg-transparent">
			<h1 class="box-cell col-md-7 col-lg-8 col-xl-9">
				<span class="text-muted font-weight-light"><i class="page-header-icon ion-monitor"></i><a href="{U_GROUP_URL}">{L_GROUP_RETURN}</a></span>
			</h1>
		</div>
	</div>

	<h2 class="font-weight-semibold m-y-3 text-muted">
		{PAGE_TITLE}<!-- IF GROUP_NAME --> :: {GROUP_NAME}<!-- ENDIF -->
	</h2>
	<hr class="page-wide-block m-t-0">

	<div class="panel">
		<div class="panel-heading">
			<div class="panel-title">{L_GROUP_INFORMATION}</div>
		</div>
		<div class="panel-body form-horizontal">

			<div class="form-group">
				<label class="col-md-3 control-label">{L_GROUP_NAME}</label>
				<div class="col-md-9">
					<input type="text" id="group_name" class="form-control" size="80" value="{GROUP_NAME}" onblur="manage_group(this.id, this.value);" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">{L_GROUP_DESCRIPTION}</label>
				<div class="col-md-9">
					<div id="preview_description"></div>
					<textarea class="form-control" cols="80" id="group_description" rows="6">{GROUP_DESCRIPTION}</textarea>

					<input class="btn" type="button" value="{L_AJAX_PREVIEW}" onclick="ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#group_description').val()});ajax.callback.posts=function(data){$('div#preview_description').html(data.message_html);initPostBBCode('div#preview_description')}">
					<input class="btn" type="button" value="{L_SAVE}" onclick="manage_group('group_description',$('textarea#group_description').val())">
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">{L_SIGNATURE}</label>
				<div class="col-md-9">
					<div id="preview_signature"></div>
					<textarea class="form-control" cols="80" id="group_signature" rows="3">{GROUP_SIGNATURE}</textarea>

					<input class="btn" type="button" value="{L_AJAX_PREVIEW}" onclick="ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#group_signature').val()});ajax.callback.posts=function(data){$('div#preview_signature').html(data.message_html);initPostBBCode('div#preview_signature')}">
					<input class="btn" type="button" value="{L_SAVE}" onclick="manage_group('group_signature',$('textarea#group_signature').val())">
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">{L_GROUP_TYPE}</label>
				<div class="col-md-9">
					<label class="custom-control custom-radio radio-inline">
						<input class="custom-control-input" type="radio" name="group_type" onchange="manage_group(this.name,this.value)" value="{S_GROUP_OPEN_TYPE}" {S_GROUP_OPEN_CHECKED} />
						<span class="custom-control-indicator"></span>
						{L_GROUP_OPEN}
					</label>
					<label class="custom-control custom-radio radio-inline">
						<input class="custom-control-input" type="radio" name="group_type" onchange="manage_group(this.name,this.value)" value="{S_GROUP_CLOSED_TYPE}" {S_GROUP_CLOSED_CHECKED} />
						<span class="custom-control-indicator"></span>
						{L_GROUP_CLOSED}
					</label>
					<label class="custom-control custom-radio radio-inline">
						<input class="custom-control-input" type="radio" name="group_type" onchange="manage_group(this.name,this.value)" value="{S_GROUP_HIDDEN_TYPE}" {S_GROUP_HIDDEN_CHECKED} />
						<span class="custom-control-indicator"></span>
						{L_GROUP_HIDDEN}
					</label>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">{L_RELEASE_GROUP}</label>
				<div class="col-md-9">
					<label class="custom-control custom-radio radio-inline">
						<input class="custom-control-input" type="radio" name="release_group" value="1" onclick="manage_group(this.name,this.value)" <!-- IF RELEASE_GROUP -->checked="checked"<!-- ENDIF --> />
						<span class="custom-control-indicator"></span>
						{L_YES}
					</label>
					<label class="custom-control custom-radio radio-inline">
						<input class="custom-control-input" type="radio" name="release_group" value="0" onclick="manage_group(this.name,this.value)" <!-- IF not RELEASE_GROUP -->checked="checked"<!-- ENDIF --> />
						<span class="custom-control-indicator"></span>
						{L_NO}
					</label>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">
					{L_AVATAR}:
				</label>
				<div class="col-md-9">

					<div id="avatar_explain" class="med">{AVATAR_EXPLAIN}</div>
					<div class="row">
					<!-- IF $bb_cfg['group_avatars']['up_allowed'] -->
					<div class="col-md-6">
						<form action="{S_GROUP_CONFIG_ACTION}" method="post" enctype="multipart/form-data">
							{S_HIDDEN_FIELDS}
                            <input type="hidden" name="MAX_FILE_SIZE" value="{$bb_cfg['group_avatars']['max_size']}" />
							<label class="custom-file px-file">
								<input type="file" name="avatar" class="custom-file-input" />
								<span class="custom-file-control form-control">Выбрать файл...</span>
								<div class="px-file-buttons">
								  <button type="button" class="btn px-file-clear">Очистить</button>
								  <button type="button" class="btn btn-primary px-file-browse">Обзор</button>
								</div>
							</label>
							<span class="input-group-btn">
								<input class="btn" type="submit" name="submit" value="{L_UPLOAD_AVATAR_FILE}" />
							</span>
						</form>
					</div>
					<!-- ENDIF -->
					<div class="col-md-6">
					<div id="avatar">
						<p>{AVATAR_IMG}</p>
						<p><input class="btn btn-danger" type="button" name="delete_avatar" value="{L_DELETE_IMAGE}" onclick="manage_group(this.name,this.value)" /></p>
					</div>
					</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
