Page 1 of 1

Stock Alert

Posted: 2018-06-05 10:52
by Moh Youba
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

Re: Stock Alert

Posted: 2018-06-05 13:27
by pbottcher
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>";

Re: Stock Alert

Posted: 2018-06-05 13:38
by Moh Youba
Hi

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

Regards