Stock Alert

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Stock Alert

Post by Moh Youba » 2018-06-05 10:52

Hello AppGini family

I am looking for a solution to create an alert for the limit of stock, any idea and help is welcome.

My table is like this
product
quantity
price

I want when the quantity is equal to 8, the field is red color

Thank you

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Stock Alert

Post by pbottcher » 2018-06-05 13:27

Hi,

you can add to the hooks/<tablename>.php file at the <tablename>_header function the following in the case statement for the TV.

Code: Select all

				$header="<%%HEADER%%><script type=\"text/javascript\">
							\$j(function(){
							\$j('td.ekjobs-JobNummer').each(function(){
								if (\$j(this).text().trim() ==8) { \$j(this).css(\"background-color\", \"red\")} ;	
						        })
					});
					</script>";
if you want the field to be red for <=8, change the comparison above accordingly.

If you want the complete row to be red and not only the one field, you can us change it to

Code: Select all

				$header="<%%HEADER%%><script type=\"text/javascript\">
							var obj = JSON.parse('{\"8\":\"red\"}');
							\$j(function(){
							\$j('td.ekjobs-JobNummer').each(function(){

								if (\$j(this).text().trim() ==8) { \$j(this).parent().css(\"background-color\", \"red\")} ;
							})
					});
					</script>";
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Re: Stock Alert

Post by Moh Youba » 2018-06-05 13:38

Hi

Thank you for your reply, I am going to try.

Regards

Post Reply