Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

teampoison's avatar

Vue api response showing on network and console but not showing on non logged in user screen

Vue api response showing on network and console but not showing on non logged in user screen

get_tests() {
  let self = this;
  self.devloader = true;
  this.$http
    .post(self.$get_tests + "?token=" + self.user_access_token)
    .then(function (response) {
      if (response.data.success == true) {
        self.diagnostics_test = response.data.data;
        console.log("diagnostics_test", self.diagnostics_test);
            self.diagnostics_test.forEach((value, index) => {
              if (index < 4) {
                value.bgcolor = "red";
              } else if (index >= 4 && index < 8) {
                value.bgcolor = "green";
              } else if (index >= 8 && index < 12) {
                value.bgcolor = "red";
              } else if (index >= 12 && index < 16) {
                value.bgcolor = "green";
              } else if (index >= 16 && index < 20) {
                value.bgcolor = "red";
              } else if (index >= 20 && index < 24) {
                value.bgcolor = "green";
              } else if (index >= 24 && index < 28) {
                value.bgcolor = "red";
              } else {
                value.bgcolor = "green";
              }
            });
          }
        })
        .catch(function (error) {
          console.log(error);
        });
      self.devloader = false;
    },
if (this.$router.history.current.path == "/service/diagnostics") {
      this.diagnostics_page = true;
      this.get_tests();
    } else {
      this.diagnostics_page = false;
      this.get_service_by_id();
      this.get_dates();
    }
<span v-if="diagnostics_page">
      <div v-if="!isMobile()" class="flex-container px-5 py-3">
        <button
          class="btn-shadow btn-lg btn btn-green f15"
          style="border-radius: 20px !important"
          @click="go_on_service()"
        >
          <i class="fa fa-arrow-left" aria-hidden="true"></i> &nbsp; Back
        </button>
      </div>

      <div class="flex-container mt-0 pl-5 pr-5">
        <div class="container">
          <div class="mb-3 mt-0 text-center">
            <p class="website_title">Diagnostics Tests</p>
            <p v-if="!isMobile()" class="website_sub_title_gray">
              Introducing the most holistic and evidence-based wellness system
              on the planet!
            </p>
          </div>
        </div>

        <div class="row">
          <div class="container">
            <div
              class="col-md-3 floatleft p-2"
              v-for="(si, idx) in diagnostics_test"
              v-bind:key="idx"
            >
              <div
                class="card-hover-shadow card mycard10 textcap textjust test-card"
                @click="
                  $bvModal.show('open-booking'),
                    assign_lab_test_function(si.id, si.test_package)
                "
              >
                <!-- <div class="test-icon"> <i class="fa fa-heartbeat" aria-hidden="true"></i> </div>    -->
                <div class="test-icon-green" v-if="si.bgcolor == 'green'">
                  <img :src="si.icon" />
                </div>
                <div class="test-icon-red" v-if="si.bgcolor == 'red'">
                  <img :src="si.icon" />
                </div>
                <div class="test-title">{{ si.test_package }}</div>

                <div class="test-green-bg" v-if="si.bgcolor == 'green'">
                  <div class="row p-2" v-if="member_profile.orgid == '1'">
                    <div class="col-4 font-weight-bold">
                      <span class="strikethrough">Rs.{{ si.main_price }}</span>
                    </div>
                    <div
                      class="col-4 text-right font-weight-bold text-color-red"
                    >
                      25% OFF
                    </div>
                    <div class="col-4 text-right font-weight-bold">
                      Rs.{{ si.price }}
                    </div>
                  </div>
                  <div class="row p-2" v-if="member_profile.orgid != '1'">
                    <div class="col-4 font-weight-bold"></div>
                    <div class="col-8 text-right font-weight-bold">
                      Included
                    </div>
                  </div>
                </div>

                <div class="test-red-bg" v-if="si.bgcolor == 'red'">
                  <div class="row p-2" v-if="member_profile.orgid == '1'">
                    <div class="col-4 font-weight-bold">
                      <span class="strikethrough">Rs.{{ si.main_price }}</span>
                    </div>
                    <div
                      class="col-4 text-right font-weight-bold text-color-red"
                    >
                      25% OFF
                    </div>
                    <div class="col-4 text-right font-weight-bold">
                      Rs.{{ si.price }}
                    </div>
                  </div>
                  <div class="row p-2" v-if="member_profile.orgid != '1'">
                    <div class="col-4 font-weight-bold"></div>
                    <div class="col-8 text-right font-weight-bold">
                      Included
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
0 likes
0 replies

Please or to participate in this conversation.