@@ -60,6 +60,7 @@ <h1 class="font-semibold tracking-tight text-xl">Plans</h1>
6060 < div class ="hidden md:flex items-center gap-2 ">
6161 < p-button pTooltip ="Expand table " class ="hidden lg:flex " icon ="pi pi-arrows-h "
6262 (click) ="isExpanded = !isExpanded " text />
63+ < p-button pTooltip ="Show filters " icon ="pi pi-filter " (click) ="toggleFiltering() " text />
6364 < p-button [pTooltip] ="tableExpandableMode ? 'f' : 'Switch table mode, allow column resizing' "
6465 [icon] ="tableExpandableMode ? 'pi pi-arrow-up-right-and-arrow-down-left-from-center' : 'pi pi-arrow-down-left-and-arrow-up-right-to-center' "
6566 (click) ="tableExpandableMode = !tableExpandableMode " text />
@@ -79,20 +80,30 @@ <h1 class="font-semibold tracking-tight text-xl">Plans</h1>
7980 </ div >
8081 </ div >
8182
83+ @if (isFilteringMode) {
84+ < div class ="grid md:grid-cols-2 gap-2 mb-2 ">
85+ < p-multiselect display ="chip " [options] ="tripTableColumns " [(ngModel)] ="tripTableSelectedColumns "
86+ styleClass ="capitalize " selectedItemsLabel ="{0} columns selected " placeholder ="Choose Columns " />
87+
88+ < input [formControl] ="tripTableSearchInput " pInputText placeholder ="Search... " />
89+ </ div >
90+ }
91+
8292 @defer {
8393 @if (flattenedTripItems.length) {
8494 < p-table [value] ="flattenedTripItems " class ="print-striped-rows " styleClass ="max-w-[85vw] md:max-w-full "
8595 [rowGroupMode] ="tableExpandableMode ? 'subheader': 'rowspan' " groupRowsBy ="td_label ">
8696 < ng-template #header >
8797 < tr >
88- < th > Day</ th >
89- < th class ="w-10 "> Time</ th >
90- < th > Text</ th >
91- < th class ="w-24 "> Place</ th >
92- < th > Comment</ th >
93- < th class ="w-20 "> LatLng</ th >
94- < th class ="w-12 "> Price</ th >
95- < th class ="w-12 "> Status</ th >
98+ @if (!tableExpandableMode && tripTableSelectedColumns.includes('day')) {< th class ="w-24 " pResizableColumn > Day
99+ </ th > }
100+ @if (tripTableSelectedColumns.includes('time')) {< th class ="w-12 " pResizableColumn > Time</ th > }
101+ @if (tripTableSelectedColumns.includes('text')) {< th pResizableColumn > Text</ th > }
102+ @if (tripTableSelectedColumns.includes('place')) {< th pResizableColumn > Place</ th > }
103+ @if (tripTableSelectedColumns.includes('comment')) {< th pResizableColumn > Comment</ th > }
104+ @if (tripTableSelectedColumns.includes('LatLng')) {< th class ="w-12 " pResizableColumn > LatLng</ th > }
105+ @if (tripTableSelectedColumns.includes('price')) {< th class ="w-12 " pResizableColumn > Price</ th > }
106+ @if (tripTableSelectedColumns.includes('status')) {< th class ="w-12 " pResizableColumn > Status</ th > }
96107 </ tr >
97108 </ ng-template >
98109 @if (tableExpandableMode) {
@@ -113,81 +124,90 @@ <h1 class="font-semibold tracking-tight text-xl">Plans</h1>
113124 < ng-template #expandedrow let-tripitem >
114125 < tr class ="h-12 cursor-pointer " [class.font-bold] ="selectedItem?.id === tripitem.id "
115126 (click) ="onRowClick(tripitem) ">
116- < td class ="font-mono text-sm max-w-20 truncate "> {{ tripitem.td_label }}</ td >
117- < td class ="font-mono text-sm "> {{ tripitem.time }}</ td >
118- < td class ="relative max-w-60 truncate ">
119- < div class ="relative ">
120- @if (tripitem.status) {< div class ="block xl:hidden absolute top-0 -left-1.5 size-1.5 rounded-full "
127+ @if (tripTableSelectedColumns.includes('time')) {< td class ="font-mono text-sm "> {{ tripitem.time }}</ td > }
128+ @if (tripTableSelectedColumns.includes('text')) {< td class ="relative ">
129+ < div class ="truncate ">
130+ @if (tripitem.status) {< div class ="block absolute top-3 left-1.5 size-2 rounded-full "
121131 [style.background] ="tripitem.status.color "> </ div > }
122132 {{ tripitem.text }}
123133 </ div >
124- </ td >
125- < td class ="relative ">
134+ </ td > }
135+ @if (tripTableSelectedColumns.includes('place')) { < td class ="relative ">
126136 @if (tripitem.place) {
127- < div class ="ml-7 print:ml-0 max-w-24 truncate print:whitespace-normal ">
137+ < div class ="ml-7 print:ml-0 truncate print:whitespace-normal ">
128138 < img [src] ="tripitem.place.image || tripitem.place.category.image "
129139 class ="absolute left-0 top-1/2 -translate-y-1/2 w-9 rounded-full object-cover print:hidden " /> {{
130140 tripitem.place.name }}
131141 </ div >
132142 } @else {-}
133- </ td >
134- < td class ="max-w-20 truncate print:whitespace-pre-line "> {{ tripitem.comment || '-' }}</ td >
135- < td class ="font-mono text-sm ">
136- < div class ="max-w-20 print:max-w-full truncate ">
143+ </ td > }
144+ @if (tripTableSelectedColumns.includes('comment')) {< td >
145+ < div class ="line-clamp-1 whitespace-pre-line print:line-clamp-none ">
146+ {{ tripitem.comment || '-' }}
147+ </ div >
148+ </ td > }
149+ @if (tripTableSelectedColumns.includes('LatLng')) {< td class ="font-mono text-sm ">
150+ < div class ="print:max-w-full truncate ">
137151 @if (tripitem.lat) { {{ tripitem.lat }}, {{ tripitem.lng }} }
138152 @else {-}
139153 </ div >
140- </ td >
141- < td class ="truncate "> @if (tripitem.price) {< span
154+ </ td > }
155+ @if (tripTableSelectedColumns.includes('price')) { < td class ="truncate "> @if (tripitem.price) {< span
142156 class ="bg-gray-100 text-gray-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded "> {{
143- tripitem.price }} {{ currency$ | async }}</ span > }</ td >
144- < td class ="truncate "> @if (tripitem.status) {< span [style.background] ="tripitem.status.color+'1A' "
145- [style.color] ="tripitem.status.color " class ="text-xs font-medium me-2 px-2.5 py-0.5 rounded "> {{
146- tripitem.status.label }}</ span > }</ td >
157+ tripitem.price }} {{ currency$ | async }}</ span > }</ td > }
158+ @if (tripTableSelectedColumns.includes('status')) {< td class ="truncate "> @if (tripitem.status) {< span
159+ [style.background] ="tripitem.status.color+'1A' " [style.color] ="tripitem.status.color "
160+ class ="text-xs font-medium me-2 px-2.5 py-0.5 rounded "> {{
161+ tripitem.status.label }}</ span > }</ td > }
147162 </ tr >
148163 </ ng-template >
149164 }
150165 @else {
151166 < ng-template #body let-tripitem let-rowgroup ="rowgroup " let-rowspan ="rowspan ">
152167 < tr class ="h-12 cursor-pointer " [class.font-bold] ="selectedItem?.id === tripitem.id "
153168 (click) ="onRowClick(tripitem) ">
154- @if (rowgroup) {
169+ @if (tripTableSelectedColumns.includes('day') && rowgroup) {
155170 < td [attr.rowspan] ="rowspan " class ="font-normal! max-w-20 truncate cursor-pointer "
156171 [class.text-blue-500] ="tripMapAntLayerDayID == tripitem.day_id "
157172 (click) ="toggleTripDayHighlightPathDay(tripitem.day_id); $event.stopPropagation() ">
158173 < div class ="truncate "> {{tripitem.td_label }}</ div >
159174 </ td >
160175 }
161- < td class ="font-mono text-sm "> {{ tripitem.time }}</ td >
162- < td class ="relative max-w-60 truncate ">
163- < div class ="relative ">
164- {{ tripitem.text }}
165- @if (tripitem.status) {< div class ="block xl:hidden absolute top-0 -left-1.5 size-1.5 rounded-full "
176+ @if (tripTableSelectedColumns.includes('time')) {< td class ="font-mono text-sm "> {{ tripitem.time }}</ td > }
177+ @if (tripTableSelectedColumns.includes('text')) {< td class ="relative max-w-60 ">
178+ < div class ="truncate ">
179+ @if (tripitem.status) {< div class ="block absolute top-3 left-1.5 size-2 rounded-full "
166180 [style.background] ="tripitem.status.color "> </ div > }
181+ {{ tripitem.text }}
167182 </ div >
168- </ td >
169- < td class ="relative ">
183+ </ td > }
184+ @if (tripTableSelectedColumns.includes('place')) { < td class ="relative ">
170185 @if (tripitem.place) {
171186 < div class ="ml-7 print:ml-0 max-w-24 truncate print:whitespace-normal ">
172187 < img [src] ="tripitem.place.image || tripitem.place.category.image "
173188 class ="absolute left-0 top-1/2 -translate-y-1/2 w-9 rounded-full object-cover print:hidden " /> {{
174189 tripitem.place.name }}
175190 </ div >
176191 } @else {-}
177- </ td >
178- < td class ="max-w-20 truncate print:whitespace-pre-line "> {{ tripitem.comment || '-' }}</ td >
179- < td class ="font-mono text-sm ">
192+ </ td > }
193+ @if (tripTableSelectedColumns.includes('comment')) {< td >
194+ < div class ="line-clamp-1 whitespace-pre-line print:line-clamp-none ">
195+ {{ tripitem.comment || '-' }}
196+ </ div >
197+ </ td > }
198+ @if (tripTableSelectedColumns.includes('LatLng')) {< td class ="font-mono text-sm ">
180199 < div class ="max-w-20 print:max-w-full truncate ">
181200 @if (tripitem.lat) { {{ tripitem.lat }}, {{ tripitem.lng }} }
182201 @else {-}
183202 </ div >
184- </ td >
185- < td class ="truncate "> @if (tripitem.price) {< span
203+ </ td > }
204+ @if (tripTableSelectedColumns.includes('price')) { < td class ="truncate "> @if (tripitem.price) {< span
186205 class ="bg-gray-100 text-gray-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded "> {{
187- tripitem.price }} {{ currency$ | async }}</ span > }</ td >
188- < td class ="truncate "> @if (tripitem.status) {< span [style.background] ="tripitem.status.color+'1A' "
189- [style.color] ="tripitem.status.color " class ="text-xs font-medium me-2 px-2.5 py-0.5 rounded "> {{
190- tripitem.status.label }}</ span > }</ td >
206+ tripitem.price }} {{ currency$ | async }}</ span > }</ td > }
207+ @if (tripTableSelectedColumns.includes('status')) {< td class ="truncate "> @if (tripitem.status) {< span
208+ [style.background] ="tripitem.status.color+'1A' " [style.color] ="tripitem.status.color "
209+ class ="text-xs font-medium me-2 px-2.5 py-0.5 rounded "> {{
210+ tripitem.status.label }}</ span > }</ td > }
191211 </ tr >
192212 </ ng-template >
193213 }
0 commit comments