kalpdev.1 / Seller appeals Advanced

// ==UserScript==
// @name         Seller appeals Advanced
// @namespace    kalpdev
// @version      0.7
// @description  Identifies incorrect inputs from TT page and Genus integrations for Reinstatement Reminder
// @author       stthorve@, shjaisw@ ,@punet , @arjmm
// @match        https://*.tt.amazon.com/*
// @match        https://tt.amazon.com/*
// @match  https://tt-test.amazon.com/*
// @require      https://code.jquery.com/jquery-3.3.1.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.es6.min.js
// @require      https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js
// @require      https://unpkg.com/sweetalert/dist/sweetalert.min.js
// @updateURL https://openuserjs.org/meta/kalpdev.1/Seller_appeals_Advanced.meta.js
// @downloadURL https://openuserjs.org/install/kalpdev.1/Seller_appeals_Advanced.user.js
// @license MIT
// ==/UserScript==
$("body").append ( `
    <div id="guide">
<style>
div#guide {padding: 4px;font-weight: bold;font-size:small; width:170px; height:28px; bottom:25px; background-color:rgba(236, 199, 199, 0.12); color:#00796b; padding:0;margin:0;border-radius:8px;position: fixed; top: 50%; right: 4%;z-index:10000; text-align:center;margin-top:40px; box-shadow: 4px 4px 8px  #00796b;" }

</style>
    <html>

<button onclick="closeWin()"; id="hide" >Seller Appeals (Genus) </button>


		<!-- Compiled and minified JavaScript -->
		<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

		<!-- Icons Included -->
		<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

		<style>
			body{ margin:0px;	padding:0px;}
			.form-section{ padding: 10px 0;	}
div.card-panel.teal {background: #ffe4c473;}
.btn, .btn-large, .btn-small {
    text-decoration: none;
    color: #fff;
    background-color: #26a69a;
    text-align: center;
    -webkit-transition: background-color .2s ease-out;
    transition: background-color .2s ease-out;
    cursor: pointer;
}
.btn, .btn-large, .btn-small, .btn-floating, .btn-large, .btn-small, .btn-flat {
    font-size: 4px;
    outline: 0;
}
.btn, .btn-large, .btn-small, .btn-flat {
    border: none;
    border-radius: 3px;
    display: inline-block;
    height: 27px;
    text-align: right;
    line-height: 1px;
    padding: 0 5px;
    text-transform: uppercase;
    vertical-align: middle;
    -webkit-tap-highlight-color: transparent;
}


.card-panel {
    -webkit-transition: -webkit-box-shadow .25s;
    transition: -webkit-box-shadow .25s;
    transition: box-shadow .25s;
    transition: box-shadow .25s, -webkit-box-shadow .25s;
    padding: 4px;
    font-weight: 100;
    margin: 0rem 0 orem 0;
    border-radius: 5px;
    background-color: #fff;
}
		</style>

		<script>

document.body.setAttribute("class", "noscroll");

    document.getElementById("overlay").style.display = "block";
    document.getElementById("spinner").style.display = "block";


    window.onload = function() {
      document.getElementById("spinner").style.display = "none";
      document.getElementById("overlay").style.display = "none";

      document.body.className = document.body.className.replace(/\bnoscroll\b/,'');
    }


</script>


		<script>

		function openAllLinks(productIDs){
			var prod_ids = productIDs.split(" ");
			var selected_option = document.asin_form.url_group.value;

			//alert(prod_ids);
			var i;
			var links = [];

			switch(selected_option) {
			  case 'url1':
				links = [ "https://genus.aka.amazon.com/#/members?programs=RestrictedProducts&marketplaces=1&asins=" ];
				break;
			  case 'url2':
				links = [ "https://genus.aka.amazon.com/#/members?programs=RestrictedProducts&marketplaces=3&asins=", ];
				break;

			  case 'url3':
				links = [ "https://genus.aka.amazon.com/#/members?programs=RestrictedProducts&marketplaces=7&asins=", ];
				break;

              case 'url4':
				links = [ "https://genus.aka.amazon.com/#/members?programs=RestrictedProducts&marketplaces=104444012&asins=", ];
				break;

              case 'url5':
				links = [ "https://genus.aka.amazon.com/#/members?programs=RestrictedProducts&marketplaces=111172&asins=", ];
				break;

              case 'url6':
				links = [ "https://genus.aka.amazon.com/#/members?programs=RestrictedProducts&marketplaces=44571&asins=", ];
				break;
				
			  case 'url7':
				links = [ "https://genus.aka.amazon.com/#/members?programs=RestrictedProducts&asins=", ];
				break;

			  default:
				links = [ "https://genus.aka.amazon.com/#/members?programs=RestrictedProducts&marketplaces=1&asins=" ];
			}


			for(i=0;i<prod_ids.length; i++)
			{

				// window.open( links[i]+prod_ids[i], '_blank', 'toolbar=yes,top=400,left=400,width=400,height=400,resizeable=yes,toolbar=yes');
				var url = links[0]+prod_ids[i];

				var win = window.open(url, '_blank');

				if (win) {
					//if Browser has allowed it to be opened
					win.blur();
				} else {
					//Else Browser has blocked it
					alert('Please allow popups for this website');
				}
			}
		}
		
		function closeWin() {
$('#hide').hide();
$('#guide').hide();
}
		</script>
	</head>
	<body>
	<header>
		<nav>
			<div class="nav-wrapper teal">
				<div class="container">
					<div class="row">

					</div>
				</div>
			</div>
		</nav>
	</header>
	<div class="wrap">
		<section class="form-section">
			<div class="container">
				<div class="row">
					<div class="col s12 l12 m12 center-align">
					</div>
					<div class="col s12 l12 m12 center-align">
						<div class="row">
							<div class="col s12 m6 offset-m3">
								<div class="card-panel teal">
									<form action="#" method="post" target="_blank" name="asin_form" id="asin_form" onsubmit="return openAllLinks(document.getElementById('prod_code').value);">

										<div class="radio_group">
										  <label>
											<input name="url_group" type="radio" value="url1" checked />
											<span>US</span>
										  </label>

										  <label>
											<input name="url_group" type="radio" value="url2" />
											<span>UK</span>
										  </label>

										  <label>
											<input class="with-gap" name="url_group" value="url3" type="radio"  />
											<span>CA</span>
										  </label>

                                           <label>
											<input class="with-gap" name="url_group" value="url4" type="radio"  />
											<span>SG</span>
										  </label>

                                          <label>
											<input class="with-gap" name="url_group" value="url5" type="radio"  />
											<span>AU</span>
										  </label>

                                          <label>
											<input class="with-gap" name="url_group" value="url6" type="radio"  />
											<span>IN</span>
										  </label>
										  
										  <label>
											<input class="with-gap" name="url_group" value="url7" type="radio"  />
											<span>Global</span>
										  </label>

										</div>

										<input type="text" class="white-text" placeholder="ASIN" name="prod_code" id="prod_code" required>

										<br /><br />
										<button class="btn waves-effect waves-light" type="submit" name="action"> <i class="material-icons right">send</i></button>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</section>
	</div>
<body style=" background: #C8E6C9; margin:3px; border: 4px solid #d42b2b; padding: 8px 8px 8px 8px; }">


	</body>
</html>
` );

var blacklist = ["we couldn't find a ticket with an id of 0000000000"],
    re = new RegExp(blacklist.join('|'), "i");
if (re.test(document.body.textContent)) {
  var win = window.open("","_self");
  win.close();
}
function testAlert(){
    $("#save-button").before('<a class="tt_button orange_button" id="check-button"><span>Check</span></a>');
    $("#save-button").hide();
    $("#tabstrip").after('<br><br><button id="Error_count" class="a-button-text" type="button">Show Error Count</button>');

    $('#Error_count').click(function(event) {
		var condition1_errcnt = localStorage.getItem("cndn1_err_cnt");
        var condition2_errcnt = localStorage.getItem("cndn2_err_cnt");
        var condition3_errcnt = localStorage.getItem("cndn3_err_cnt");
        var condition4_errcnt = localStorage.getItem("cndn4_err_cnt");
        var condition5_errcnt = localStorage.getItem("cndn5_err_cnt");
        var condition8_errcnt = localStorage.getItem("cndn8_err_cnt");
        var condition9_errcnt = localStorage.getItem("cndn9_err_cnt");
        var condition10_errcnt = localStorage.getItem("cndn10_err_cnt");
        var condition11_errcnt = localStorage.getItem("cndn11_err_cnt");
        var resolution_text_errcnt = localStorage.getItem("resolution_text_err_cnt");

        condition1_errcnt = (condition1_errcnt == null) ? 0 : condition1_errcnt;
        condition2_errcnt = (condition2_errcnt == null) ? 0 : condition2_errcnt;
        condition3_errcnt = (condition3_errcnt == null) ? 0 : condition3_errcnt;
        condition4_errcnt = (condition4_errcnt == null) ? 0 : condition4_errcnt;
        condition5_errcnt = (condition5_errcnt == null) ? 0 : condition5_errcnt;
        condition8_errcnt = (condition8_errcnt == null) ? 0 : condition8_errcnt;
        condition9_errcnt = (condition9_errcnt == null) ? 0 : condition9_errcnt;
        condition10_errcnt = (condition10_errcnt == null) ? 0 : condition10_errcnt;
        condition11_errcnt = (condition11_errcnt == null) ? 0 : condition11_errcnt;
        resolution_text_errcnt = (resolution_text_errcnt == null) ? 0 : resolution_text_errcnt;

        swal({
            title: "Error Count",
            text: "Condition 1 :  " + condition1_errcnt + "\nCondition 2 :  " + condition2_errcnt + "\nCondition 3 :  " + condition3_errcnt + "\nCondition 4 :  " + condition4_errcnt + "\nCondition 5 :  " + condition5_errcnt + "\nCondition 8 :  " + condition8_errcnt + "\nCondition 9 :  " + condition9_errcnt + "\nCondition 10 :  " + condition10_errcnt + "\nCondition 11 :  " + condition11_errcnt + "\Resolution Text Missing :  " + resolution_text_errcnt,
            button: "OK"
        });

    });

    $('#check-button').click(function(event) {
        var root_cause = document.getElementById('root_cause').value;
        if(root_cause.includes("Re-Open")==true)
        {
            swal("TT is updated", {
      icon: "success",
    });
            $("#save-button").click();
            //alert("valid");
        }
        else
        {
			var correspondence_text = document.getElementById('correspondence').value;
			var lowercase_string_check = correspondence_text.toLowerCase();
			var rootCause = document.getElementById('root_cause').value;
			var lowercase_rootCause = rootCause.toLowerCase();
			var resolution_text = document.getElementById('resolution').value;
			var ticket_status = document.getElementById('status').value;
            var error_check = "";
            var error_string = "";
            var error_string_1 = "";
            var error_string_2 = "";
            var flag_1 = 0;
            var flag_2 = 0;
            var flag_3 = 0;
			var cndn_2_check = "";
			var cndn_3_check = "";
			var cndn_4_check = "";
			var cndn_8_check = "";
			var cndn_9_check = "";
			var cndn_10_check = "";
			var cndn_11_check = "";

            //condition 5
            if(lowercase_string_check.includes("has been reinstated")==true)
            {
                if(lowercase_rootCause.includes("resolved (bulk restricted_incorrectly )")==false && lowercase_rootCause.includes("resolved (reinstated_rule update)")==false && lowercase_rootCause.includes("resolved (seller's proof reviewed- reinstated)")==false && lowercase_rootCause.includes("resolved (reinstated_seller's proof reviewed)")==false && lowercase_rootCause.includes("resolved (reinstated _quarantine)")==false && lowercase_rootCause.includes("resolved (content ok)")==false && lowercase_rootCause.includes("resolved (reinstated_incorrectly restricted by c-ops-rp)")==false && lowercase_rootCause.includes("resolved (reinstated_incorrectly restricted by auto-review)")==false && lowercase_rootCause.includes("resolved (keyword string - asin reinstated)")==false && lowercase_rootCause.includes("resolved (legal confirmed product ok for sale)")==false && lowercase_rootCause.includes("resolved (reinstated_seller made changes)")==false && lowercase_rootCause.includes("resolved (reinstated_seller provided proof)")==false)
                {
                    flag_2 = 1;
                    if(localStorage.getItem("cndn5_err_cnt") === null) {
                        localStorage.setItem("cndn5_err_cnt", 1);                        }
                    else{      localStorage.cndn5_err_cnt = Number(localStorage.cndn5_err_cnt) + 1;            }

                    //condition 1
                    if(lowercase_string_check.includes("\"\"")==true)
                    {
                        flag_1 = 1;
                        error_string_1 = "\n* Fill Content In The Codes";
                        if(localStorage.getItem("cndn1_err_cnt") === null) {
                            localStorage.setItem("cndn1_err_cnt", 1);                          }
                        else{      localStorage.cndn1_err_cnt = Number(localStorage.cndn1_err_cnt) + 1;            }
                    }
                }
                else
                {
                    //condition 1
                    if(lowercase_string_check.includes("\"\"")==true)
                    {
                        flag_1 = 1;
                        error_string_1 = "\n* Fill Content In The Codes";
                        if(localStorage.getItem("cndn1_err_cnt") === null) {
                            localStorage.setItem("cndn1_err_cnt", 1);                          }
                        else{      localStorage.cndn1_err_cnt = Number(localStorage.cndn1_err_cnt) + 1;            }
                    }

                }
            }
            else
            {
                //condition 1
                if(lowercase_string_check.includes("\"\"")==true)
                {
                    flag_1 = 1;
                    error_string_1 = "\n* Fill Content In The Codes";
                    if(localStorage.getItem("cndn1_err_cnt") === null) {
                        localStorage.setItem("cndn1_err_cnt", 1);                          }
                    else{      localStorage.cndn1_err_cnt = Number(localStorage.cndn1_err_cnt) + 1;            }
                }

				//condition 2
				if(lowercase_string_check.includes("cannot be reinstated")==true)
				{
					if(lowercase_rootCause.includes("resolved (bulk restricted_correctly )")==false && lowercase_rootCause.includes("resolved (restricted_correctly) manual review required")==false && lowercase_rootCause.includes("resolved (restricted_ correctly) sop not followed")==false && lowercase_rootCause.includes("resolved (seller's proof reviewed- restricted)")==false && lowercase_rootCause.includes("resolved (incorrectly approved by auto-review)")==false && lowercase_rootCause.includes("resolved (keyword string - restricted asin)")==false)
					{
                        if(lowercase_string_check.includes("bad detail page")==true)
                        {
                            cndn_3_check = cndtn_3();
                        }
                        if(lowercase_string_check.includes("provide the asin")==true)
                        {
                            cndn_4_check = cndtn_4();
                        }
                        if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true)
                        {
                            cndn_8_check = cndtn_8();
                        }
                        if(lowercase_string_check.includes("new ticket has been created")==true)
                        {
                            cndn_9_check = cndtn_9();
                        }
                        if(lowercase_string_check.includes("already live on site")==true)
                        {
                            cndn_10_check = cndtn_10();
                        }
                        if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes("only for reinstatement requests")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true)
                        {
                            cndn_11_check = cndtn_11();
                        }

                        if(cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid")
                        {
                            //alert("No Error");
                        }
						else
						{
                            flag_2 = 1;
                            if(localStorage.getItem("cndn2_err_cnt") === null) {
                                localStorage.setItem("cndn2_err_cnt", 1);                          }
                            else{      localStorage.cndn2_err_cnt = Number(localStorage.cndn2_err_cnt) + 1;            }

						}
					}
				}

				//condition 3
				if(lowercase_string_check.includes("bad detail page")==true)
				{
					if(lowercase_rootCause.includes("resolved (restricted_bad detail page)")==false)
					{
                        if(lowercase_string_check.includes("cannot be reinstated")==true)
                        {
                            cndn_2_check = cndtn_2();
                        }
                        if(lowercase_string_check.includes("provide the asin")==true)
                        {
                            cndn_4_check = cndtn_4();
                        }
                        if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true)
                        {
                            cndn_8_check = cndtn_8();
                        }
                        if(lowercase_string_check.includes("new ticket has been created")==true)
                        {
                            cndn_9_check = cndtn_9();
                        }
                        if(lowercase_string_check.includes("already live on site")==true)
                        {
                            cndn_10_check = cndtn_10();
                        }
                        if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true)
                        {
                            cndn_11_check = cndtn_11();
                        }

                        if(cndn_2_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid")
                        {
                            //alert("No Error");
                        }
						else
						{
                            flag_2 = 1;
                            if(localStorage.getItem("cndn3_err_cnt") === null) {
                                localStorage.setItem("cndn3_err_cnt", 1);                          }
                            else{      localStorage.cndn3_err_cnt = Number(localStorage.cndn3_err_cnt) + 1;            }
						}
					}
				}

				//condition 4
				if(lowercase_string_check.includes("provide the asin")==true)
				{
					if(lowercase_rootCause.includes("resolved (restricted_incomplete information)")==false)
					{
						if(lowercase_string_check.includes("cannot be reinstated")==true)
                        {
                            cndn_2_check = cndtn_2();
                        }
                        if(lowercase_string_check.includes("bad detail page")==true)
                        {
                            cndn_3_check = cndtn_3();
                        }
                        if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true)
                        {
                            cndn_8_check = cndtn_8();
                        }
                        if(lowercase_string_check.includes("new ticket has been created")==true)
                        {
                            cndn_9_check = cndtn_9();
                        }
                        if(lowercase_string_check.includes("already live on site")==true)
                        {
                            cndn_10_check = cndtn_10();
                        }
                        if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true)
                        {
                            cndn_11_check = cndtn_11();
                        }

                        if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid")
                        {
                            //alert("No Error");
                        }
						else
						{
                            flag_2 = 1;
                            if(localStorage.getItem("cndn4_err_cnt") === null) {
                                localStorage.setItem("cndn4_err_cnt", 1);                          }
                            else{      localStorage.cndn4_err_cnt = Number(localStorage.cndn4_err_cnt) + 1;            }
						}
					}
				}

				//condition 8
				if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true)
				{
					if(lowercase_rootCause.includes("resolved (duplicate tt)")==false)
					{
                        if(lowercase_string_check.includes("cannot be reinstated")==true)
                        {
                            cndn_2_check = cndtn_2();
                        }
                        if(lowercase_string_check.includes("bad detail page")==true)
                        {
                            cndn_3_check = cndtn_3();
                        }
                        if(lowercase_string_check.includes("provide the asin")==true)
                        {
                            cndn_4_check = cndtn_4();
                        }
                        if(lowercase_string_check.includes("new ticket has been created")==true)
                        {
                            cndn_9_check = cndtn_9();
                        }
                        if(lowercase_string_check.includes("already live on site")==true)
                        {
                            cndn_10_check = cndtn_10();
                        }
                        if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true)
                        {
                            cndn_11_check = cndtn_11();
                        }

                        if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid")
                        {
                            //alert("No Error");
                        }
						else
						{
                            flag_2 = 1;
                            if(localStorage.getItem("cndn8_err_cnt") === null) {
                                localStorage.setItem("cndn8_err_cnt", 1);                          }
                            else{      localStorage.cndn8_err_cnt = Number(localStorage.cndn8_err_cnt) + 1;            }
						}
					}
				}

				//condition 9
				if(lowercase_string_check.includes("new ticket has been created")==true)
				{
					if(lowercase_rootCause.includes("resolved (tt to legal - rationale states legal handles appeal)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller has appealed multiple times)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller provided additional documentation)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller removed/added claim on detail page)")==false && lowercase_rootCause.includes("resolved (tt to legal - unable to take decision)")==false && lowercase_rootCause.includes("resolved (flipping ticket to internal sme queue)")==false && lowercase_rootCause.includes("resolved (new tt assigned to other team)")==false)
					{
                        if(lowercase_string_check.includes("cannot be reinstated")==true)
                        {
                            cndn_2_check = cndtn_2();
                        }
                        if(lowercase_string_check.includes("bad detail page")==true)
                        {
                            cndn_3_check = cndtn_3();
                        }
                        if(lowercase_string_check.includes("provide the asin")==true)
                        {
                            cndn_4_check = cndtn_4();
                        }
                        if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true)
                        {
                            cndn_8_check = cndtn_8();
                        }
                        if(lowercase_string_check.includes("already live on site")==true)
                        {
                            cndn_10_check = cndtn_10();
                        }
                        if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true)
                        {
                            cndn_11_check = cndtn_11();
                        }

                        if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid")
                        {
                            //alert("No Error");
                        }
						else
						{
                            flag_2 = 1;
                            if(localStorage.getItem("cndn9_err_cnt") === null) {
                                localStorage.setItem("cndn9_err_cnt", 1);                          }
                            else{      localStorage.cndn9_err_cnt = Number(localStorage.cndn9_err_cnt) + 1;            }
						}
					}
				}

				//condition 10
				if(lowercase_string_check.includes("already live on site")==true)
				{
					if(lowercase_rootCause.includes("resolved (live_ after ticket was cut)")==false && lowercase_rootCause.includes("resolved (live_ at the time ticket was cut)")==false)
					{
                        if(lowercase_string_check.includes("cannot be reinstated")==true)
                        {
                            cndn_2_check = cndtn_2();
                        }
                        if(lowercase_string_check.includes("bad detail page")==true)
                        {
                            cndn_3_check = cndtn_3();
                        }
                        if(lowercase_string_check.includes("provide the asin")==true)
                        {
                            cndn_4_check = cndtn_4();
                        }
                        if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true)
                        {
                            cndn_8_check = cndtn_8();
                        }
                        if(lowercase_string_check.includes("new ticket has been created")==true)
                        {
                            cndn_9_check = cndtn_9();
                        }
                        if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true)
                        {
                            cndn_11_check = cndtn_11();
                        }

                        if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_11_check=="valid")
                        {
                            //alert("No Error");
                        }
						else
						{
                            flag_2 = 1;
							if(localStorage.getItem("cndn10_err_cnt") === null) {
                                localStorage.setItem("cndn10_err_cnt", 1);                          }
                            else{      localStorage.cndn10_err_cnt = Number(localStorage.cndn10_err_cnt) + 1;            }
						}
					}
				}

				//condition 11
				if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true)
				{
					if(lowercase_rootCause.includes("resolved (wrong cti)")==false && lowercase_rootCause.includes("resolved ( tombstoned -nei reviewed)")==false && lowercase_rootCause.includes("kindly reach out to the below cti")==false)
					{
                        if(lowercase_string_check.includes("cannot be reinstated")==true)
                        {
                            cndn_2_check = cndtn_2();
                        }
                        if(lowercase_string_check.includes("bad detail page")==true)
                        {
                            cndn_3_check = cndtn_3();
                        }
                        if(lowercase_string_check.includes("provide the asin")==true)
                        {
                            cndn_4_check = cndtn_4();
                        }
                        if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true)
                        {
                            cndn_8_check = cndtn_8();
                        }
                        if(lowercase_string_check.includes("new ticket has been created")==true)
                        {
                            cndn_9_check = cndtn_9();
                        }
                        if(lowercase_string_check.includes("already live on site")==true)
                        {
                            cndn_10_check = cndtn_10();
                        }

                        if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid")
                        {
                            //alert("No Error");
                        }
						else
						{
                            flag_2 = 1;
                            if(localStorage.getItem("cndn11_err_cnt") === null) {
                                localStorage.setItem("cndn11_err_cnt", 1);                          }
                            else{      localStorage.cndn11_err_cnt = Number(localStorage.cndn11_err_cnt) + 1;            }
						}
					}
				}

	function cndtn_2(){
        if(lowercase_rootCause.includes("resolved (bulk restricted_correctly )")==false && lowercase_rootCause.includes("resolved (restricted_correctly) manual review required")==false && lowercase_rootCause.includes("resolved (restricted_ correctly) sop not followed")==false && lowercase_rootCause.includes("resolved (incorrectly approved by c-ops-rp)")==false && lowercase_rootCause.includes("resolved (incorrectly approved by auto-review)")==false && lowercase_rootCause.includes("resolved (keyword string - restricted asin)")==false)
        {
            return "incorrect";
        }
        else
        {
            return "valid";
        }
	}
	function cndtn_3(){
        if(lowercase_rootCause.includes("resolved (restricted_bad detail page)")==false)
        {
            return "incorrect";
        }
        else
        {
            return "valid";
        }
	}
	function cndtn_4(){
        if(lowercase_rootCause.includes("resolved (restricted_incomplete information)")==false)
        {
			return "incorrect";
        }
        else
        {
            return "valid";
        }
	}
	function cndtn_8(){
        if(lowercase_rootCause.includes("resolved (duplicate tt)")==false)
        {
            return "incorrect";
        }
        else
        {
            return "valid";
        }
	}
	function cndtn_9(){
        if(lowercase_rootCause.includes("resolved (tt to legal - rationale states legal handles appeal)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller has appealed multiple times)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller provided additional documentation)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller removed/added claim on detail page)")==false && lowercase_rootCause.includes("resolved (tt to legal - unable to take decision)")==false && lowercase_rootCause.includes("resolved (flipping ticket to internal sme queue)")==false && lowercase_rootCause.includes("resolved (new tt assigned to other team)")==false)
        {
            return "incorrect";
        }
        else
        {
            return "valid";
        }
	}
	function cndtn_10(){
        if(lowercase_rootCause.includes("resolved (live_ after ticket was cut)")==false && lowercase_rootCause.includes("resolved (live_ at the time ticket was cut)")==false)
        {
            return "incorrect";
        }
        else
        {
            return "valid";
        }
	}
	function cndtn_11(){
        if(lowercase_rootCause.includes("resolved (wrong cti)")==false && lowercase_rootCause.includes("resolved ( tombstoned -nei reviewed)")==false && lowercase_rootCause.includes("kindly reach out to the below cti")==false)
        {
            return "incorrect";
        }
        else
        {
            return "valid";
        }
	}
            }

			if(ticket_status == 'Resolved')
			{
				if(resolution_text == '')
				{
					flag_3 = 1;
					if(localStorage.getItem("resolution_text_err_cnt") === null) {
						localStorage.setItem("resolution_text_err_cnt", 1);                          }
					else{      localStorage.resolution_text_err_cnt = Number(localStorage.resolution_text_err_cnt) + 1;            }
				}
			}

            if(flag_2!="0" || flag_1!="0" || flag_3!="0")
            {
                if(flag_2!="0")
                {
                    error_string = "\n* Incorrect Root Cause Selected";
                }
                if(flag_3!="0")
                {
                    error_string_2 = "\n* Resolution Field is blank";
                }
                    var msg = error_string_1 + error_string + error_string_2;
                    swal({
                        title: "Alert",
                        text: "Following errors has been observed :\n" + msg,
                        button: "OK"
                    });
            }
            else if(error_check=="")
            { 
				if(lowercase_string_check.includes("compliant and has been reinstated")==true)
				{
				     swal({
  title: "Reinstatement Reminder !!",
  text: "Please ensure the approval of ASIN in GENUS tool",
  icon: "warning",
  buttons: ["Not checked", "Yes checked"],
  dangerMode: true,
})
.then((checked) => {
  if (checked) {
    swal("TT is updated", {
      icon: "success",
    });
      $("#save-button").click();
  } else {
    swal("Please Reinstate the ASIN in Genus");
  }
});
                   
				}
                $("#check-button").hide();
                $("#save-button").show();
                //alert("valid");
            }
        }
    });
}

window.onLoad = testAlert();