From 0e33b327d18cf9d21ad0a1e7c4df128f4c733763 Mon Sep 17 00:00:00 2001
From: Kevin von Spiczak <kevin.spiczak@sgalinski.de>
Date: Tue, 11 Jan 2022 16:50:56 +0100
Subject: [PATCH] [TASK] add reset filter button, add labels

---
 .../Private/Backend/Layouts/Default.html      |   1 +
 .../Private/Backend/Partials/Filter.html      |  14 ++-
 Resources/Private/Language/de.locallang.xlf   |   6 +-
 Resources/Private/Language/locallang.xlf      |   3 +
 Resources/Public/JavaScript/Backend/SgJobs.js |  20 ++-
 Resources/Public/StyleSheets/backend.css      | 118 ++++++++++++++++++
 6 files changed, 155 insertions(+), 7 deletions(-)
 create mode 100644 Resources/Public/StyleSheets/backend.css

diff --git a/Resources/Private/Backend/Layouts/Default.html b/Resources/Private/Backend/Layouts/Default.html
index fa390fae..d0a13851 100644
--- a/Resources/Private/Backend/Layouts/Default.html
+++ b/Resources/Private/Backend/Layouts/Default.html
@@ -2,6 +2,7 @@
 {namespace sg=SGalinski\SgJobs\ViewHelpers}
 
 <f:be.container
+	includeCssFiles="{0: '{f:uri.resource(path: \'StyleSheets/backend.css\')}'}"
 	includeRequireJsModules="{
 		0: 'TYPO3/CMS/Backend/ContextMenu',
 		1: 'TYPO3/CMS/Backend/Tooltip',
diff --git a/Resources/Private/Backend/Partials/Filter.html b/Resources/Private/Backend/Partials/Filter.html
index b54e0eeb..3209b888 100644
--- a/Resources/Private/Backend/Partials/Filter.html
+++ b/Resources/Private/Backend/Partials/Filter.html
@@ -23,13 +23,21 @@
 		<div class="col-xs-6">
 			<div class="form-group">
 				<label for="filter-search"><f:translate key="backend.filters.search" /></label>
-				<f:form.textfield class="form-control" property="search" id="filter-search" />
+				<f:form.textfield class="reset-me form-control" property="search" id="filter-search" />
 			</div>
-			<div class="form-inline">
-				<f:form.button class="btn btn-success form-group pull-right" type="submit" additionalAttributes="{style: 'min-width: 150px;'}">
+		</div>
+		<div class="form-group">
+			<div class="col-md-12 col-xs-12">
+				<f:form.button class="filter-btn btn btn-success form-group col-xs-12 col-md-12" type="submit">
 					<f:translate key="backend.filter" />
 				</f:form.button>
+				<f:form.button id="filter-reset-btn"
+							   class="filter-btn btn btn-danger form-group col-xs-12 col-md-12"
+							   type="reset">
+					<f:translate key="backend.reset_filter" />
+				</f:form.button>
 			</div>
 		</div>
+
 	</div>
 </f:form>
diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf
index 652d3b46..196eb472 100644
--- a/Resources/Private/Language/de.locallang.xlf
+++ b/Resources/Private/Language/de.locallang.xlf
@@ -91,7 +91,11 @@
 			</trans-unit>
 			<trans-unit id="backend.filter" approved="yes">
 				<source><![CDATA[Filter]]></source>
-				<target><![CDATA[Filter]]></target>
+				<target><![CDATA[Filter anwenden]]></target>
+			</trans-unit>
+			<trans-unit id="backend.reset_filter" approved="yes">
+				<source><![CDATA[Reset filter]]></source>
+				<target><![CDATA[Filter zurücksetzen]]></target>
 			</trans-unit>
 			<trans-unit id="backend.filters.editLocation" approved="yes">
 				<source><![CDATA[Edit selected location]]></source>
diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf
index fbb5707a..82f3d43d 100644
--- a/Resources/Private/Language/locallang.xlf
+++ b/Resources/Private/Language/locallang.xlf
@@ -72,6 +72,9 @@
 			<trans-unit id="backend.filter">
 				<source><![CDATA[Filter]]></source>
 			</trans-unit>
+			<trans-unit id="backend.reset_filter" approved="yes">
+				<source><![CDATA[Reset filter]]></source>
+			</trans-unit>
 			<trans-unit id="backend.filters.editLocation">
 				<source><![CDATA[Edit selected location]]></source>
 			</trans-unit>
diff --git a/Resources/Public/JavaScript/Backend/SgJobs.js b/Resources/Public/JavaScript/Backend/SgJobs.js
index 4d07b4d9..95bfec75 100644
--- a/Resources/Public/JavaScript/Backend/SgJobs.js
+++ b/Resources/Public/JavaScript/Backend/SgJobs.js
@@ -30,10 +30,24 @@ define([
 ], function ($, ModuleMenu, Viewport) {
 	var SgJobs = {
 		init: function() {
-			$('.sg-jobs_pageswitch').on('click', function(event) {
-				event.preventDefault();
-				SgJobs.goTo('web_SgJobsBackend', event.target.dataset.page);
+			$(document).ready(function() {
+				$('.sg-jobs_pageswitch').on('click', function(event) {
+					event.preventDefault();
+					SgJobs.goTo('web_SgJobsBackend', event.target.dataset.page);
+				});
+				$('#filter-reset-btn').on('click', function(event) {
+					event.preventDefault();
+					this.form.reset();
+					$(this).closest('form').find('option:selected').each(function() {
+						$(this).removeAttr('selected');
+					});
+
+					$('.reset-me').val('');
+
+					this.form.submit();
+				});
 			});
+
 		},
 		/**
 		 * Switch the page and select it in the pagetree
diff --git a/Resources/Public/StyleSheets/backend.css b/Resources/Public/StyleSheets/backend.css
new file mode 100644
index 00000000..cb7b1604
--- /dev/null
+++ b/Resources/Public/StyleSheets/backend.css
@@ -0,0 +1,118 @@
+.module-docheader-bar-column-right {
+	/*margin: 12px;*/
+}
+
+.btn-save-backend {
+	margin-top: 10px;
+}
+
+.btn-sm {
+	margin-left: 5px;
+}
+
+.editor-description {
+	padding: 10px;
+}
+
+.email-input {
+	padding: 5px 6px;
+	vertical-align: top;
+	width: 300px;
+}
+
+.f3-widget-paginator {
+	display: inline-block;
+	border-radius: 4px;
+	margin: 20px 0;
+	padding-left: 0;
+	background-color: red;
+}
+
+.f3-widget-paginator > li {
+	display: inline;
+}
+
+.f3-widget-paginator > li > a,
+.f3-widget-paginator > li.current {
+	position: relative;
+	float: left;
+	padding: 6px 12px;
+	margin-left: -1px;
+	text-decoration: none;
+	border: 1px solid #DDD;
+	background-color: #FFF;
+	color: #FF8700;
+}
+
+.f3-widget-paginator > li.current,
+.f3-widget-paginator > li > a:hover,
+.f3-widget-paginator > li > a:focus {
+	text-decoration: underline;
+	background-color: #EEE;
+}
+
+.f3-widget-paginator > li:first-child > a,
+.f3-widget-paginator > li.current:first-child {
+	margin-left: 0;
+	border-top-left-radius: 4px;
+	border-bottom-left-radius: 4px;
+}
+
+.f3-widget-paginator > li:last-child > a,
+.f3-widget-paginator > li.current:last-child {
+	border-top-right-radius: 4px;
+	border-bottom-right-radius: 4px;
+}
+
+.template-col:nth-of-type(even) {
+	/*background-color: #DCDCDC;*/
+	/*background-clip: content-box;*/
+}
+
+.template-col:nth-of-type(odd) {
+	/*background-color: #AAA;*/
+	/*background-clip: content-box;*/
+}
+
+.recordlist hr {
+	margin: 5px 0;
+	border-top: 1px solid #EAEAEA;
+}
+
+.recordlist-mail-unsent {
+	background-color: #CCC !important;
+}
+
+.filter-btn {
+	width: auto;
+	min-width: 100px;
+	margin-right: 10px;
+}
+
+.language-selector {
+	display: inline-block;
+	margin-left: 9px;
+}
+
+.markers-card {
+	border: none;
+	margin-bottom: 0;
+	box-shadow: none;
+}
+
+a.accordion-header-toggle .fa-caret-down {
+	display: none;
+}
+
+a.accordion-header-toggle.collapsed .fa-caret-down {
+	display: inline-block;
+}
+
+a.accordion-header-toggle.collapsed .fa-caret-up {
+	display: none;
+}
+
+.form-actions {
+	margin-bottom: 5px;
+	clear: both;
+}
-- 
GitLab