
<div class="panel panel-custom">
	<form id="passwordForm">
		<div class="modal-body form-horizontal">
			<div class="form-group">
				<div class="col-lg-12">
					<?= form_input_group('my_password', lang('password'), '', 'password', true); ?>
				</div>
			</div>
			<div class="modal-footer mt-4">
				<button type="submit" class="btn btn-primary btn-md">
					<?= lang('update') ?>
				</button>
			</div>
		</div>
	</form>
</div>


<script>
	$(document).ready(function() {


		$('#passwordForm').on('submit', function(e) {
			e.preventDefault(); // IMPORTANT


			 var my_password = $('input[name="my_password"]').val();
            var encrypt_password = '<?= $password ?>';
            var ids = '<?= $ids ?>';

			$.ajax({
				url: base_url + "admin/common/check_current_password",
				type: "POST",
				dataType: "json",
				data: {
					password: my_password,
					encrypt_password: encrypt_password,
					ids: ids,
				},
				success: function(res) {
					if (res.error) {
						handle_error('#hosting_password', res.error);
						return;
					}


					remove_error('#hosting_password');
					handle_error('#show_password', res.message);
					$('#myModal').modal('hide');
				}
			});
		});
	});
</script>
