Snippets Collections
$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~                              # (1)
[ edit files as necessary ]                    # (2)
$ git add .                                    # (3)
$ git commit -c ORIG_HEAD                      # (4)
<div class=" w-full h-screen p-4">

    <div class="h-14 w-full bg-slate-100 rounded-md font-semibold text-gray-800 flex items-center text-center px-2 transition-colors">
        <div class=" basis-1/3 rounded-md bg-white py-2 shadow-sm">New Items</div>
        <div class=" basis-1/3 rounded-md ">Return Items</div>
        <div class=" basis-1/3 rounded-md ">Issue Items</div>
    </div>

</div>
Qtr =

SWITCH(
	TRUE(),
	MONTH('Calendar[Date]') <=3, "Q1",
	MONTH('Calendar[Date]') <=6, "Q2",
	MONTH('Calendar[Date]') <=9, "Q3",
	"Q4"
)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>
<style>
    section.heroCarousel-container.mobile {
     display: none;
    }
    @media (max-width:551px){
        section.heroCarousel-container{
            display: none;
        }
        section.heroCarousel-container.mobile {
            display: block;
        }
        section.heroCarousel-container.mobile .slick-slide {
            display: flex !important;
            justify-content: center;
            position: relative;
        }
        .mobile-carousal-btns {
            position: absolute;
            top: 65%;
            margin: 0 auto;
            width: auto;
        }
        section.heroCarousel-container.mobile .slick-slide img {
            display: block;
            width: 100%;
            /*height: 380px;*/
        }
        /*.cstm-pos{*/
        /*    position: absolute;*/
        /*    background: none !important;*/
        /*    margin-top: 41%;*/
        /*    text-align: center;*/
        /*}*/
        .cstm-pos {
            position: absolute;
            background: none !important;
            text-align: center;
            top: 50%;
        }
        .heroCarousel-content{
            background-color: transparent;
        }
        .carousal-container-mbl{
            display: flex;
            justify-content: center;
            align-items: center;
        }
    }
</style>


{{inject 'hasMainCarousel' true}}
<section class="heroCarousel-container desktop {{#if theme_settings.carousel_banners}} heroCarousel-container--hasBanners{{/if}}">
    <div class="heroCarousel"
        data-slick='{
            "dots": true,
            "mobileFirst": true,
            "slidesToShow": 1,
            "slidesToScroll": 1,
            "autoplay": true,
            "autoplaySpeed": {{carousel.swap_frequency}},
            "lazyLoad": "anticipated"
        }'
        {{#if theme_settings.carousel_video_mute}} data-youtube-mute{{/if}}>
        {{#each carousel.slides}}
        <div class="heroCarousel-slide {{#if ../theme_settings.homepage_carousel_style '==' 'stretch'}}heroCarousel-slide--stretch{{/if}} heroCarousel-slide--{{@index}}{{#if @first}} heroCarousel-slide--first{{/if}}">
            <div class="heroCarousel-image-wrapper{{#and image_height image_width}} heroCarousel-image-wrapper--sized{{/and}}">
                <a href="{{url}}">
                    {{#if @index '==' 0}}
                        {{#if (merge this video=../../theme_settings.carousel_vid0)}}{{/if}}
                    {{/if}}
                    {{#if @index '==' 1}}
                        {{#if (merge this video=../../theme_settings.carousel_vid1)}}{{/if}}
                    {{/if}}
                    {{#if @index '==' 2}}
                        {{#if (merge this video=../../theme_settings.carousel_vid2)}}{{/if}}
                    {{/if}}
                    {{#if @index '==' 3}}
                        {{#if (merge this video=../../theme_settings.carousel_vid3)}}{{/if}}
                    {{/if}}
                    {{#if @index '==' 4}}
                        {{#if (merge this video=../../theme_settings.carousel_vid4)}}{{/if}}
                    {{/if}}

                    

                    {{#if video}}
                        <div class="heroCarousel-video-wrapper">
                            <div class="heroCarousel-image-box" style="{{#if image_width}}width:{{image_width}}px{{/if}}">
                                {{#and image_height image_width}}<div class="heroCarousel-image-box-padding" style="padding-bottom:{{multiply (divide image_height image_width) 100}}%">{{/and}}
                                    {{> components/common/responsive-img
                                        image=stencil_image
                                        class="heroCarousel-image"
                                        fallback_size='1920w'
                                        lazyload='disabled'
                                    }}
                                {{#and image_height image_width}}</div>{{/and}}
                            </div>
                            <div class="heroCarousel-video"><div data-youtube="{{video}}"></div></div>
                        </div>
                    {{else}}
                        <div class="heroCarousel-image-box" style="{{#if image_width}}width:{{image_width}}px{{/if}}">
                            {{#and image_height image_width}}<div class="heroCarousel-image-box-padding" style="padding-bottom:{{multiply (divide image_height image_width) 100}}%">{{/and}}
                                {{#if @first}}
                                    {{> components/common/responsive-img
                                        image=stencil_image
                                        class="heroCarousel-image"
                                        fallback_size='1920w'
                                        lazyload='disabled'
                                        otherAttributes=(concat (concat (concat (concat 'width="' image_width) '" height="') image_height) '"')
                                    }}
                                {{else}}
                                    {{> components/common/responsive-img
                                        image=stencil_image
                                        class="heroCarousel-image"
                                        fallback_size='1920w'
                                        lazyload='lazyload'
                                        otherAttributes=(concat (concat (concat (concat 'width="' image_width) '" height="') image_height) '"')
                                    }}
                                {{/if}}
                            {{#and image_height image_width}}</div>{{/and}}
                        </div>
                    {{/if}}
                    
                    {{#if heading}}
                        {{> components/carousel-content show_background=true}}
                    {{else}}
                        {{#if text}}
                            {{> components/carousel-content show_background=true}}
                        {{else}}
                            {{#if button_text}}
                                {{> components/carousel-content show_background=false}}
                            {{/if}}
                        {{/if}}
                    {{/if}}
                </a>
            </div>
        </div>
        {{/each}}
    </div>
    {{#if theme_settings.carousel_banners}}
        <div class="heroCarousel-banners">
            {{> components/papa-supermarket/sections/section-bc-banner find="papathemesHeroCarouselBanner"}}
        </div>
    {{/if}}
</section>


<!--Custome Carousal for Mobile-->
<section class="heroCarousel-container mobile {{#if theme_settings.carousel_banners}} heroCarousel-container--hasBanners{{/if}}">
    <div class="heroCarousel"
        data-slick='{
            "dots": true,
            "mobileFirst": true,
            "slidesToShow": 1,
            "slidesToScroll": 1,
            "autoplay": true,
            "autoplaySpeed": {{carousel.swap_frequency}},
            "lazyLoad": "anticipated"
        }'
        {{#if theme_settings.carousel_video_mute}} data-youtube-mute{{/if}}>
       
            
    <a href="/" class="cstm-l0">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-66.jpg" />
    		    <!--<a href="https://www.smartwheel.ca/inokim/" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns"></a>-->
    		    <div class="cstm-pos cstm-c0" ></div>
            </div>
        </a>
        
        <a href="/" class="cstm-l1">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-57.jpg" />
    		    <!--<a href="https://www.smartwheel.ca/inokim/" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns"></a>-->
    		    <div class="cstm-pos cstm-c1" ></div>
            </div>
        </a>
		    
        
        <a href="/" class="cstm-l2">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-53.jpeg" />
            	<!--<a href="/nanrobot-d6-e-scooter-10-2000w-52v-26ah-black/" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns">Pre-Order Now</a>-->
                <div class="cstm-pos cstm-c2" ></div>
            </div>
        </a>
       
        <a href="/" class="cstm-l3">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-31.jpeg"/>
        	    <!--<a href="/OneWheel_c_114.html" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns">Learn More</a>-->
        	    <div class="cstm-pos cstm-c3" ></div>
    	    </div>
        </a>
    
            <a href="/" class="cstm-l4">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-64.jpg" />
        		<!--<a href="/SmartKick_c_127.html" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns">Buy Now</a>-->
                <div class="cstm-pos cstm-c4" ></div>
            </div> 
        </a>
      
    </div>
    {{#if theme_settings.carousel_banners}}
        <div class="heroCarousel-banners">
            {{> components/papa-supermarket/sections/section-bc-banner find="papathemesHeroCarouselBanner"}}
        </div>
    {{/if}}
</section>

<script>
    $(document).ready(function(){
        console.log("test")
        setTimeout(function(){
            var i=0;
            $(".desktop .slick-track .heroCarousel-slide").each(function(index, element) {
                console.log("test")
                try{
                    if (!$(this).hasClass("slick-cloned")) {
                        
                        var des =$(".heroCarousel-content",$(element)).html();
                        
                        $(".cstm-c"+i).append(des);
                        
                        var href = $("a",$(element)).attr('href');
                        
                        $(".cstm-l"+i).attr("href", href);
        
                        i++;
                    }
                }
                catch(e){}
            });
        }, 1000);
    })
</script>
    r = sr.Recognizer()
    with anvil.media.TempFile(AudioFile) as file_name:
      with sr.AudioFile(file_name) as source:
        audio = r.record(source)
    response = r.recognize_google(audio)
// C++ program to find LCM of two numbers 
#include <iostream> 
using namespace std; 

// Recursive function to return gcd of a and b 
long long gcd(long long int a, long long int b) 
{ 
if (b == 0) 
	return a; 
return gcd(b, a % b); 
} 

// Function to return LCM of two numbers 
// Time Complexity: O(log(min(a,b) 
// Auxiliary Space: O(log(min(a,b))
long long lcm(int a, int b) 
{ 
	return (a / gcd(a, b)) * b; 
} 

// Function to return LCM of two numbers  Time Complexity: O(min(a,b))
int LCM(int a, int b) 
{ 
    int greater = max(a, b); 
    int smallest = min(a, b); 
    for (int i = greater; ; i += greater) { 
        if (i % smallest  == 0) 
            return i; 
    } 
} 

// Driver program to test above function 
int main() 
{ 
	int a = 15, b = 20; 
	cout <<"LCM of " << a << " and "
		<< b << " is " << lcm(a, b); 
	return 0; 
} 
#include <bits/stdc++.h>
using namespace std;

#define sr srand(time(0));
#define ra(l, h) (rand() % ((h)-(l)+1) + (l))
#define sync { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
#define ll long long int
#define vi vector<int>
#define fn(n) for(int i = 0; i < n; i++)
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rfr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define all(a) a.begin(), a.end()
#define tt int test; cin >> test; while(test--)
#define ff first
#define ss second
#define en cout<< "\n"
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl



int countTrailingZeros(int num) {
    int count = 0;
    while (num % 10 == 0) {
        count++;
        num /= 10;
    }
    return count;
}

bool isPrime(int n) {
    if (n <= 1) {
        return false;
    }
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}


int main() {
    sync
    tt {
        int n;
        cin >> n;
        vi v(n);
        fn(n) cin >> v[i];
    
        int commonZeros = countTrailingZeros(v[0]);

        for (int i = 1; i < n; i++) {
            int trailingZeros = countTrailingZeros(v[i]);
            commonZeros = min(commonZeros, trailingZeros);
        }
        
        // cout << commonZeros << " ";
        
        int ans = 0;
        set<int> rem;
        for(ll k=2; k<pow(10,18); k++){
            if( isPrime(k) ) {
                k = k * pow(10, commonZeros);
                for(int i=0; i<n; i++){
                    rem.insert(v[i]%k);
                }
                if(rem.size() == 2){
                    ans = k;
                    break;
                }
            }
        }
        
        cout << ans << endl;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define sr srand(time(0));
#define ra(l, h) (rand() % ((h)-(l)+1) + (l))
#define sync { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
#define ll long long int
#define vi vector<int>
#define fn(n) for(int i = 0; i < n; i++)
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rfr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define all(a) a.begin(), a.end()
#define tt int test; cin >> test; while(test--)
#define ff first
#define ss second
#define en cout<< "\n"
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl


int main() {
    sync
    tt {
        int n;
        cin >> n;
        vi v(n);
        fn(n) cin >> v[i];
        
        fn(n) cout<<v[i]<<" ";
      	cout << "\n";
        
        
    }
    return 0;
}



/*
        
*/ 
            
	function getGoldPrice($apiKey,$symbol) {
  
    $curr = "USD";
    $date = "";

    $url = "https://www.goldapi.io/api/{$symbol}/{$curr}{$date}";

    $myHeaders = array(
        'x-access-token: ' . $apiKey,
        'Content-Type: application/json'
    );

    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTPHEADER => $myHeaders
    ));

    $response = curl_exec($curl);
    $error = curl_error($curl);

    curl_close($curl);

    if ($error) {
        return 'Error: ' . $error;
    } else {
        $data = json_decode($response, true);

        // Check if the response contains a 'price' key
        if (isset($data['price'])) {
            return $data['price'];
        } 
    }
}
	
	function fetchDataAndInsertIntoDatabase($pdo)
	{
		$apiKey = "goldapi-xxd2ktl4miz8nf-io";
		$symbol = "XAU";
		$curr = "SAR";
		$date = "";
		$myHeaders = array(
		'x-access-token: ' . $apiKey,
		'Content-Type: application/json'
		);

		$curl = curl_init();
		$url = "https://www.goldapi.io/api/{$symbol}/{$curr}{$date}";

		curl_setopt_array($curl, array(
		CURLOPT_URL => $url,
		CURLOPT_RETURNTRANSFER => true,
		CURLOPT_FOLLOWLOCATION => true,
		CURLOPT_HTTPHEADER => $myHeaders
		));
		$response = curl_exec($curl);
		$error = curl_error($curl);
		curl_close($curl);

		if ($error) {
		//	echo 'Error: ' . $error;
		} else {
			$data = json_decode($response, true);
			if ($data !== null) {
				$price_gram_24k = $data['price_gram_24k'];
				$price_gram_22k = $data['price_gram_22k'];
				$price_gram_21k = $data['price_gram_21k'];
				$price_gram_20k = $data['price_gram_20k'];
				$price_gram_18k = $data['price_gram_18k'];
				$price_gram_16k = $data['price_gram_16k'];
				$price_gram_14k = $data['price_gram_14k'];
				$price_gram_10k = $data['price_gram_10k'];
				$timestamp = $data['timestamp'];
				$goldPrice = getGoldPrice($apiKey,$symbol);

				try {
					$stmt = $pdo->prepare("INSERT INTO gold (price_gram_24k, price_gram_22k, price_gram_21k, price_gram_20k, price_gram_18k, price_gram_16k, price_gram_14k, price_gram_10k, timestamp,price) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,?)");

					$stmt->execute([$price_gram_24k,$price_gram_22k, $price_gram_21k, $price_gram_20k, $price_gram_18k, $price_gram_16k,$price_gram_14k,$price_gram_10k, $timestamp,$goldPrice]);

					// echo 'Data inserted successfully!';
				} catch (PDOException $e) {
				//	echo 'Error: ' . $e->getMessage();
				} finally {
					$pdo = null;
				}
			} else {
			//	echo 'Error decoding JSON';
			}
		}
	}
    r = sr.Recognizer()
    with anvil.media.TempFile(AudioFile) as file_name:
      with sr.AudioFile(file_name) as source:
        audio = r.record(source)
    response = r.recognize_google(audio)
function sortEvents(events) {
  //   return Object.keys(events)
  //     .sort()
  //     .reduce((sortedEvents, key) => {
  //       sortedEvents[key] = events[key];
  //       return sortedEvents;
  //     }, {});

  const sortedEvents = {};
  Object.keys(events)
    .sort()
    .forEach((key) => {
      sortedEvents[key] = events[key];
    });
  return sortedEvents;
}
function add_prefix_to_prices($price) {
    // قم بتحديد الكلمة أو التاج الذي تريد إضافته
    $prefix = '<div class=div_p>ajax</div>';

    // قم بإرجاع السعر مع الكلمة أو التاج
    return $prefix . $price;
}

add_filter('woocommerce_get_price_html', 'add_prefix_to_prices');
add_filter('woocommerce_cart_item_price', 'add_prefix_to_prices');
add_filter('woocommerce_cart_item_subtotal', 'add_prefix_to_prices');
@media (min-width:768px) and (max-width:920px) {
    nav ul {
        gap: 50px;
        margin-left: 0px;
    }

    .iknow {
        position: relative;
        right: 0px;
        align-items: center;
        /* top: 20px; */
        margin-top: 20%;
    }
    #aditya img{
        width: 11%;
    }
    .connect{
        top: 24%;
    }
    .banner h2{
        font-size: 16px;
        top: 16%;
    }   
    .banner {
        height: 113px;
    }
    #bannerimgrec{
        height: 115px;
    }
}
  @import url('https://fonts.googleapis.com/css2?family=Aclonica&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Aoboshi+One&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Amaranth&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Amaranth&family=Bubblegum+Sans&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Aldrich&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Andika&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Atma:wght@600&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Black+Ops+One&family=Ubuntu&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Candal&display=swap');
  @import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@700&display=swap');

  body {
      padding: 0;
      margin: 0;
      background: #392467;
      overflow-x: hidden;
      scroll-behavior: smooth;
      /* overflow-y: hidden; */
  }

  nav {
      display: flex;
      align-items: center;
      justify-content: space-between;
  }

  nav ul li a {
      text-decoration: none;
      font-family: 'Aoboshi One', serif;
      color: white;
      font-size: 25px;
  }

  nav ul li {
      list-style: none;
  }

  nav ul {
      gap: 90px;
      display: flex;
      margin-left: 46px;
  }

  .downloadcv a {
      position: absolute;
      right: 32px;
      top: 15px;
      list-style: none;
      text-decoration: none;
      /* font-family: 'Aclonica', sans-serif; */
      font-size: 25PX;
      color: white;
      font-family: 'Aoboshi One', serif;
      transition: all 0.4s ease-in-out;
  }

  .downloadcv a:hover {
      transform: scale(1.09);
      transition: all 0.4s ease-in-out;
  }

  .downloadcv img {
      width: 220px;
      position: relative;
      /* left: 37px; */
      right: 8px;
      top: 2px;
      /* height: 41px;*/
      transition: all 0.5s ease-in-out;
  }

  .banner a img {
      width: 11%;
      position: absolute;
      left: 3%;
      top: 75px;
  }

  .banner h2 {
      position: absolute;
      top: 25px;
      font-family: 'Amaranth', sans-serif;
      color: white;
      font-weight: 300;
      top: 18%;
      left: 18%;
      font-size: 20px;
  }


  .section h4 {
      font-family: 'Aoboshi One', serif;
      font-size: 15px;
      color: white;
      font-weight: 400;
      margin: 0;
  }

  .connect {
      display: flex;
      position: absolute;
      top: 29%;
      right: 2%;
      align-items: center;

  }

  .connectimg {
      display: flex;
      align-items: center;
      position: relative;
      margin-top: 9px;
      gap: 4px;

  }

  .connectimg li a {
      text-decoration: none;
  }

  .connectimg li {
      list-style: none;
      text-decoration: none;
  }

  #link img {
      width: 25px;
  }

  #x img {
      width: 19px;
  }

  .connectimg {
      margin-left: 5px;
  }

  .connectimg img {
      width: 20px;
  }

  .heading h1 {

      color: white;
      font-size: 70px;
      margin: 0;
      font-weight: 400;
      letter-spacing: 3px;
      /* font-family: 'Aclonica', sans-serif; */
      font-family: 'Aoboshi One', serif;
      text-shadow: 0px 8px 40px rgba(255, 255, 255, 0.316);
  }

  .heading h2 {
      font-size: 50px;
      margin: 0;
      letter-spacing: 3px;
      font-weight: 400;
      font-family: 'Aclonica', sans-serif;
      font-family: 'Aoboshi One', serif;
      color: white;
      text-shadow: 0px 8px 40px rgba(255, 255, 255, 0.316);

  }

  .heading {
      position: relative;
      top: 80px;
      left: 15%;
  }

  .iknow {
      position: absolute;
      right: 90px;
      align-items: center;
  }

  .iknow h1 {
      font-family: 'Bubblegum Sans', sans-serif;
      color: white;
      font-weight: 300;
  }

  .know {
      display: flex;
      justify-content: center
  }

  .img {
      display: flex;
      justify-content: center;
  }

  .img img {
      width: 60px;
  }

  .overlay {
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      top: 10rem;
      /* left: 11rem;
      right: 11rem; */
      /*width: 1000px;
      border-radius: 30px;
      height: 350px;
      background-color: #5D3587;
      margin-bottom: 30px; */
  }

  .inerabout {
      position: relative;
      left: 0%;
      top: -352px;
  }

  .inercontent {
      position: relative;
      top: -43vh;
  }

  .ul {
      line-height: 3;
      font-size: 1.3rem;
  }

  .about {
      display: flex;
      justify-content: center;
      align-items: center;
      text-align: center;
      margin: 0;

  }

  .about h1 {
      color: #FFF;
      margin: 0;
      margin-top: 20px;
      margin-bottom: 10px;
      font-family: 'Aclonica', sans-serif;
      font-size: 2.5rem;
      text-shadow: 0px 8px 40px rgba(0, 0, 0, 0.25);
      font-style: normal;
      font-weight: 400;
      line-height: normal;
  }

  .aboutcontent h1 {
      color: #D2D2D2;
      margin: 0;
      text-align: center;
      text-shadow: 0px 8px 40px rgba(0, 0, 0, 0.25);
      font-family: 'Aldrich', sans-serif;
      font-size: 1.8rem;
      font-style: normal;
      font-weight: 400;
      line-height: normal;
  }

  .aboutcontent p {
      font-family: 'Andika', sans-serif;
      color: #fff;
  }

  .aboutcontent ul li {
      font-family: 'Andika', sans-serif;
      color: #fff
  }

  .marquee {
      position: relative;
      top: 213px;
  }

  .marquee h1 {
      font-family: 'Ubuntu', sans-serif;
      font-size: 5rem;
      margin-bottom: px;
      color: #ffffff08;
  }

  .projects img {
      width: 28%;
  }

  .projects h1 {
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      top: -14vh;
      font-size: 3rem;
      color: white;
      font-family: 'Aclonica', sans-serif;
      text-shadow: 0px 8px 40px rgb(0, 0, 0);
  }

  .probg {
      display: flex;
      justify-content: center;
      align-items: center;
  }

  .project-flexo {
      display: flex;
      justify-content: center;
      align-items: center;
      /* right: -4%;
    position: relative; */
  }

  .ultable {
      display: flex;
      justify-content: center;
      align-items: center;
      text-align: justify;
  }

  /* .rectangle-shape{
    display: flex;
    justify-content: center;
    align-items: center;
  } */
  .bg-rec {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 10px;
      margin-left: 10px;
      margin-right: 10px;
      margin-bottom: 10px;
      margin-top: -69px;

  }

  .bg-rec li {
      list-style: none;
  }

  .bg-rec img {
      width: 100%;
      display: flex;
      border-top-right-radius: 10px;
      border-top-left-radius: 10px;
      transition: all 0.3s ease-in-out;
  }


  .text-rec {
      position: relative;
      top: -20px;
      /* color: white; */
      width: 100%;
      height: 15vh;
      background: #fff;
      border-bottom-right-radius: 10px;
      border-bottom-left-radius: 10px;
      transition: all 0.3s ease-in-out;
  }

  .text-rec:hover {
      box-shadow: 0px 8px 40px rgba(177, 177, 177, 0.397);
  }

  .text-rec h1 {
      font-family: 'Candal', sans-serif;
      color: #000;
      margin: 0;
      font-size: 20px;
      font-weight: 400;
      padding-left: 10px;

  }

  .text-rec p {
      font-family: 'Amarnath', sans-serif;
      font-size: 15px;
      font-weight: 400;
      color: #4f4f52;
      padding-left: 10px;
  }

  .text-rec a {
      text-decoration: none;
  }

  .marquee-projects {
      font-family: 'Ubuntu', sans-serif;
      font-size: 5rem;
      margin-bottom: 0px;
      color: #ffffff08;

  }

  .contactbg {
      display: flex;
      justify-content: center;
      align-items: center;
  }

  .contacthead-flexo {
      color: #D2D2D2;
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      top: -450px;
  }

  #c-us {
      font-size: 1.9rem;
      font-family: 'Ubuntu', sans-serif;
  }

  .p1 {
      font-size: 1.5rem;
      font-family: 'Ubuntu', sans-serif;
  }

  #bannerimgrec {
      width: 100%;
      height: 166px;
  }

  .p2,
  .p3,
  .p4 {
      font-size: 14.5px;
      font-family: 'Ubuntu', sans-serif;
      font-weight: 400;
  }

  .p3 a {
      color: #6b88ff;
  }

  footer {
      width: 100%;
      height: 8vh;
      background: #A367B1;
  }

  footer p {
      font-family: 'Ubuntu', sans-serif;
      font-weight: 600;


  }

  .copyrights {
      display: flex;
      justify-content: center;
      align-items: center;
      text-align: center;
      margin-top: -53px;
  }
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Aditya Mishra Portfolio</title>
    <link rel="stylesheet" href="index.css">
    <link rel="shortcut icon" href="png/AdityaColoRimg 1.png">
    <link rel="stylesheet" href="media.css">
    <script src="https://kit.fontawesome.com/yourcode.js" crossorigin="anonymous"></script>
</head>

<body>
    <div id="home">
        <header>
            <nav>
                <!-- <input type="checkbox" id="check">
                <label for="check">
                    <i class="fa fa-bars"></i>
                </label> -->
                <ul class="navbar">
                    <li>
                        <a href="#home" target="_blank">Home</a>
                    </li>
                    <li>
                        <a href="#work" target="_blank">Work</a>
                    </li>
                    <li>
                        <a href="#about" target="_blank">About</a>
                    </li>
                    <li>
                        <a href="#contact" target="_blank">Contact Us</a>
                    </li>
                </ul>
                <div class="downloadcv">
                    <img src="png/Rectangle 6.png" alt="">
                    <a href="https://drive.google.com/file/d/1SkGOJ3pkXJMJo15rz8pp0PyT_a-I2G8Z/view?usp=sharing"
                        target="_blank" download="mypdffile">Download CV</a>
                </div>
            </nav>
        </header>
        <section class="section">


            <div class="banner">
                <img src="png/Rectangle 8 (1).png" alt="" id="bannerimgrec">
                <a href="#" id="aditya"><img src="png/AdityaColoRimg 1.png" alt="">
                    <style>
                        #aditya img {
                            width: 10%;
                        }
                    </style>
                </a>
                <div class="text">
                    <h2>Hi, I am Aditya Mishra A passionate front-end <br> Dev Based in New Delhi, India.
                    </h2>
                </div>
            </div>
            <div class="connect">
                <div class="connecttext">
                    <h4>Lets Connect :
                    </h4>

                </div>
                <div class="connectimg">
                    <a href="https://www.linkedin.com/in/adityamishra95/" target="_blank" id="link"><img
                            src="portfolio design/LinkedIn-Logos/LI-In-Bug.png" alt=""></a>
                    <a href="https://github.com/adityamishra2023" target="_blank" id="git"><img
                            src="portfolio design/github-mark-white.png" alt=""></a>
                    <a href="https://twitter.com/adityamishra_95" target="_blank" id="x"><img
                            src="portfolio design/logo-white.png" alt=""></a>
                </div>

            </div>
    </div>
    </section>
    <section class="sectiontwo">
        <div class="heading">
            <h2>Front-End</h2>
            <h1>Developer</h1>
        </div>
        <div class="iknow">
            <div class="know">
                <h1>What I Know</h1>
            </div>
            <div class="img">
                <img src="portfolio design/icons8-html-logo-48.png" alt="">
                <img src="portfolio design/icons8-css-logo-48.png" alt="">
                <!-- </div> -->
                <!-- <div class="img"> -->
                <img src="portfolio design/icons8-javascript-48.png" alt="">
                <img src="portfolio design/icons8-bootstrap-logo-48.png" alt="">
            </div>
        </div>

    </section>

    <section class="sectionthree" style="margin-top: 23px;  margin-bottom: -15%;">


        <div class="marquee">
            <marquee behavior="scroll" direction="left">
                <h1>&nbsp;ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT
                    ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT ABOUT
                    ABOUT ABOUT ABOUT ABOUT ABOUT</h1>
            </marquee>
        </div>
        <div id="about">
            <div class="about-container">
                <div class="headoverlay">
                    <div clabass="overlay" style="display: flex;
                justify-content: center;
                position: relative;
                top: 150px;">
                        <img src="png/Rectangle 2.png" alt="">
                    </div>
                </div>
                <div class="inerabout">

                    <div class="overlaycontent">
                        <div class="about">
                            <h1>About</h1>
                        </div>
                        <div class="aboutcontent">
                            <h1>Front-End Developer </h1>
                            <div class="ultable">

                                <ul class="ul">
                                    <p>🛠️ What I bring to the table:</p>
                                    <li>
                                        Expertise in creating robust and responsive interfaces
                                    </li>
                                    <li>Proficiency in modern web development technologies and frameworks</li>
                                    <li>Extensive experience in translating design concepts into seamless,
                                        high-performance
                                        applications
                                    </li>
                                    <li>Commitment to staying on the cutting edge of industry trends</li>
                                    <li>Strong problem-solving skills with a focus on code quality and maintainability
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </section>
    <section>
        <div class="marquee-projects">
            <marquee behavior="scroll" direction="left">
                <h1 class="marquee-h1">&nbsp;PROJECT PROJECT PROJECT PROJECT PROJECT PROJECT PROJECT PROJECT</h1>
            </marquee>
            <div id="work">
                <div class="projects">
                    <div class="probg">
                        <img src="png/Rectangle 6.png" alt="">
                    </div>
                    <h1>Projects</h1>
                </div>
                <div class="rectangle-shape">
                    <div class="bg-rec">
                        <li id="red-box"><a href="https://netflix-project-11-2023.netlify.app/" target="_blank"><img
                                    src="portfolio design/netflixclone.png" alt="Netflix Project"></a>
                            <div class="text-rec">
                                <a href="https://netflix-project-11-2023.netlify.app/" target="_blank">
                                    <h1>Netflix Clone</h1>
                                </a>
                                <p>HTML, CSS</p>
                            </div>
                        </li>
                        <li id="pink-box"><a href="https://myntraclonework.netlify.app/" target="_blank"><img
                                    src="portfolio design/myntra.png" alt=""></a>
                            <div class="text-rec">
                                <a href="https://myntraclonework.netlify.app/" target="_blank">
                                    <h1>Myntra Clone</h1>
                                </a>
                                <p>HTML, CSS</p>
                            </div>
                        </li>
                        <li id="green-box"><img src="portfolio design/spotifyclone.png" alt="Spotify Clone">
                            <div class="text-rec">
                                <h1>Spotify Clone</h1>
                                </a>
                                <p>HTML, CSS</p>
                            </div>
                        </li>
                    </div>
                </div>
            </div>
    </section>
    <section>
        <div class="contact-container">
            <div class="marquee-projects">
                <marquee behavior="scroll" direction="left">
                    <h1 class="marquee-h1">&nbsp;LETS CONNECT LETS CONNECT LETS CONNECT LETS CONNECT LETS CONNECT LETS
                        CONNECT LETS CONNECT LETS CONNECT LETS CONNECT LETS CONNECT LETS CONNECT LETS CONNECT LETS
                        CONNECT LETS CONNECT LETS CONNECT LETS CONNECT </h1>
                </marquee>
            </div>
            <div id="contact">
                <div class="contactbg">
                    <img src="png/Rectangle 2.png" alt="">
                </div>
                <div class="contacthead-flexo">
                    <div class="contacthead">
                        <h1 id="c-us">Contact Us</h1>
                        <p class="p1"> 🚀 Cheers to creating engaging and memorable online <br> experiences!</p>
                        <p class="p2"> Let's connect! I'm always open to discussing exciting opportunities</p>
                        <p class="p3">📧 Email: <a
                                href="mailto:adityamishra80012@gmail.com">adityamishra80012@gmail.com</a>
                        </p>
                        <p class="p4">📍 Location: New Delhi, India </p>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <footer>
        <div class="copyrights">
            <p>Copyright © 2023. All rights are reserved</p>
        </div>
    </footer>
</body>

</html>
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
{
  ...
  "content_scripts": [
    {
      "matches": ["https://*.example.com/*"],
      "include_globs": ["*example.com/???s/*"],
      "js": ["content-script.js"]
    }
  ],
  ...
}
:root {
    --theme--page_preview-padding: 0;
}
.notion-table-view{
    padding-left:0;
    padding-right:0;
}
.fullWidth .notion-frame .notion-scroller.vertical .notion-page-content>.notion-collection_view-block .notion-scroller div.notion-table-view, .fullWidth .notion-frame .notion-scroller.vertical .notion-page-content>.notion-collection_view-block>div[style*="padding-left"],
.fullWidth .notion-frame .notion-scroller.vertical .notion-page-content>.notion-collection_view-block .notion-scroller div.notion-gallery-view{
  padding-left:0!important;
  padding-right:0!important;
}
.enhancer--tweak-normalise_table_scroll .notion-collection-view-body .notion-table-view {
  width: 100% !important;
  padding-left: 0!important;
  padding-right: 0!important;
}
.layout.layout-wide{
  --margin-width: 30px!important;
}
.fullWidth .notion-frame .notion-scroller.vertical .notion-page-content>.notion-collection_view-block div[style*=left][style*="position: sticky"]{
  left: 0px !important;
}
sudo docker container inspect  --format='{{.LogPath}}' <container-name>
sudo truncate -s 0 <path_to_log_file>
var print = Logger.log;

var webEngageLicense = '~2024b5d8';
var usersUrl = "https://api.webengage.com/v1/accounts/" + webEngageLicense + "/bulk-users";
var eventsUrl = "https://api.webengage.com/v1/accounts/" + webEngageLicense + "/bulk-events";

var headers = {
  "Authorization": "Bearer 426a654c-89b6-4595-af9c-fd3712af56f9",
  "Content-Type": "application/json"
}

/////////////////////////////////// MENU BUTTONS ///////////////////////////////////

// function onOpen() {
//   var ui = SpreadsheetApp.getUi();
//   var add_modules = ui.createMenu("USERS_DATA");
//   add_modules.addItem('TEST', 'users_to_WE_TEST').addToUi();
//   add_modules.addItem('UPSC FORM RESP', 'users_to_WE_UPSC_FORM_RESP').addToUi();
// }

/////////////////////////////////// MAP KEYS ///////////////////////////////////

function map_keys(sheetName) {
  var mapper_keys = {}
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var ActiveSheet = ss.getSheetByName(sheetName);
  var lastColumn = ActiveSheet.getLastColumn()
  var headers = ActiveSheet.getRange(1, 1, 1, lastColumn).getValues()[0]
  for (var k = 0; k < lastColumn; k++) {
    mapper_keys[headers[k]] = k
  }
  return (mapper_keys)
}

/////////////////////////////////// CALL API ///////////////////////////////////

function callApi(targetURL, method, payload, headers) {
  var options = {
    'method': method,
    'payload': payload,
    'headers': headers
  }
  try {
    var response = UrlFetchApp.fetch(targetURL, options);
  } catch (e) {
    // print(e)
    return [e, 0]
  }
  var respText = JSON.parse(response.getContentText());
  var respStatus = response.getResponseCode();
  return [respText, respStatus]
}

///////////////////////////////////////////// GENERATE USER ID /////////////////////////////////////////////

function generateUserId(row, prefix, startCounter) {
  // var prefix = "fmp_gf_";
  // var startCounter = 198230;
  var zeros = "000000";

  var idNumber = (startCounter + row - 1).toString()
  var uniqueUserId = prefix + (zeros + idNumber).slice(-7);

  return uniqueUserId;
}

//////////////////////////////////////// USER FETCHING FROM RESPONSE SHEETs ////////////////////////////////////////

function fetch_users_from_sheet(sheetName) {
  var sheetConfigurations = {
    "UPSC_FORM_1": {
      url: "https://docs.google.com/spreadsheets/d/1a0AglRKvK8aqee1wWZnpkQDGQXLtMa9Gy3g7EgjgzSI/edit?resourcekey#gid=1768755200",
      shName: "Form Responses 1",
      startRow: 1,
      destinationSheetName: "Users_to_WE UPSC_FORM_1",
      emailIdx: 1,
      phoneIdx: 3,
      nameIdx: 6,
      prefix: "fmp_upsc1_",
      startCounter: 000000,
    },
    "UPSC_FORM_2": {
      url: "https://docs.google.com/spreadsheets/d/1a0AglRKvK8aqee1wWZnpkQDGQXLtMa9Gy3g7EgjgzSI/edit?resourcekey#gid=1244699291",
      shName: "google_form_leads",
      startRow: 1,
      destinationSheetName: "Users_to_WE UPSC_FORM_2",
      emailIdx: 1,
      phoneIdx: 2,
      nameIdx: 0,
      prefix: "fmp_upsc2_",
      startCounter: 000000,
    },
    "JUDI_FORM": {
      url: "https://docs.google.com/spreadsheets/d/1DZ9hwfJiW5-6JckwicpaVeGotgLEYm6RVScs2GhnXIk/edit#gid=0",
      shName: "Sheet1",
      startRow: 1,
      destinationSheetName: "Users_to_WE JUDI_FORM",
      emailIdx: 1,
      phoneIdx: 2,
      nameIdx: 0,
      prefix: "fmp_jud1_",
      startCounter: 000000,
    },
  };

  var sheetConfig = sheetConfigurations[sheetName];

  var sourceSheet = SpreadsheetApp.openByUrl(sheetConfig.url).getSheetByName(sheetConfig.shName);
  var lastRow = sourceSheet.getLastRow();
  var numRows = lastRow - sheetConfig.startRow + 1;
  var sourceData = sourceSheet.getRange(sheetConfig.startRow, 1, numRows, sourceSheet.getLastColumn()).getValues();

  var destinationSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetConfig.destinationSheetName);
  var destinationData = destinationSheet.getDataRange().getValues();

  if (destinationData.length < sourceData.length) {
    var newRows = sourceData.slice(destinationData.length);
    for (var i = 0; i < newRows.length; i++) {
      var row = destinationData.length + i + 1;
      var email = String(newRows[i][sheetConfig.emailIdx]);
      var phone = String(newRows[i][sheetConfig.phoneIdx]);
      phone = (phone.length === 10) ? "91" + phone : phone;
      var name = String(newRows[i][sheetConfig.nameIdx]);

      if (email != "#ERROR!" && phone != "#ERROR!" && name != "#ERROR!" && phone.length == 12) {
        var uniqueUserId = generateUserId(row, sheetConfig.prefix, sheetConfig.startCounter);
        destinationSheet.getRange(row, 1).setValue(uniqueUserId);
        destinationSheet.getRange(row, 2).setValue(email);
        destinationSheet.getRange(row, 3).setValue(phone);
        destinationSheet.getRange(row, 4).setValue(name);
        destinationSheet.getRange(row, 5).setValue("TRUE");
      }
    }
  }
}

///////////////////////////////////////// USERS API - UPSC_FORM_1 /////////////////////////////////////////

function users_to_WE_UPSC1() {
  var mapper_keys = map_keys('Users_to_WE UPSC_FORM_1')
  SpreadsheetApp.flush()

  fetch_users_from_sheet("UPSC_FORM_1");

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE UPSC_FORM_1');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var userList = [];
  var batchSize = 25;

  var userIndexList = [];
  var errorUserList = [];

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status !== "Success" && status !== "Error" && status !== "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      var email = String(currentRow[mapper_keys['email']]);
      var mobile = String(currentRow[mapper_keys['phone']]);
      var name = String(currentRow[mapper_keys['first_name']]);

      if (email != "#ERROR!" && mobile != "#ERROR!" && name != "#ERROR!" && mobile.length == 12) {
        var user = {
          'userId': user_id,
          'email': email,
          'firstName': name,
          'phone': mobile,
          'whatsappOptIn': true,
        };
        userList.push(user);
        userIndexList.push(idx);

        if (userList.length === batchSize) {
          var payload = { "users": userList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
            errorUserList = errorUserList.concat(...userIndexList);
          }

          var userList = [];
          var userIndexList = [];
        }
        if (idx % 50 === 0) {
          print("Delay Added: 5 Sec");
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('User Integrated');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (userList.length > 0) {
    var payload = { "users": userList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
      errorUserList = errorUserList.concat(...userIndexList);
    }
  }

  if (errorUserList.length > 0) {
    print(errorUserList);
    for (var e in errorUserList) {
      webEngageSheet.getRange(parseInt(errorUserList[e]) + StartRow, mapper_keys['status'] + 1).setValue('Failed User Api');
    }
  }

  print("Done User Integration - UPSC_FORM_1");
}

////////////////////////////////////////////////// EVENTS API - UPSC_FORM_1 //////////////////////////////////////////////////

function users_to_events_UPSC1() {
  var mapper_keys = map_keys('Users_to_WE UPSC_FORM_1')
  SpreadsheetApp.flush()

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE UPSC_FORM_1');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var eventName = "UPSC_FA";

  var eventUserList = [];
  var batchSize = 25;

  var userIndexList = [];
  var errorUserList = [];

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status === "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      if (user_id) {
        var eventUser = {
          "userId": user_id,
          "eventName": eventName
        };
        eventUserList.push(eventUser);
        userIndexList.push(idx);

        if (eventUserList.length === batchSize) {
          var payload = { "events": eventUserList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
            errorUserList = errorUserList.concat(...userIndexList);
          }

          var eventUserList = [];
          var userIndexList = [];
        }
        if (idx % 50 === 0) {
          print("Delay Added: 5 Sec");
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Success');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (eventUserList.length > 0) {
    var payload = { "events": eventUserList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
      errorUserList = errorUserList.concat(...userIndexList);
    }
  }

  if (errorUserList.length > 0) {
    print(errorUserList);
    for (var e in errorUserList) {
      webEngageSheet.getRange(parseInt(errorUserList[e]) + StartRow, mapper_keys['status'] + 1).setValue('Failed Event Api');
    }
  }

  print("Done User To Event - UPSC_FORM_1")
}

////////////////////////////////////////////////// USERS API - UPSC_FORM_2 //////////////////////////////////////////////////

function users_to_WE_UPSC2() {
  var mapper_keys = map_keys('Users_to_WE UPSC_FORM_2')
  SpreadsheetApp.flush()

  fetch_users_from_sheet("UPSC_FORM_2");

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE UPSC_FORM_2');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var userList = [];
  var batchSize = 25;

  var userIndexList = [];
  var errorUserList = [];

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status !== "Success" && status !== "Error" && status !== "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      var email = String(currentRow[mapper_keys['email']]);
      var mobile = String(currentRow[mapper_keys['phone']]);
      var name = String(currentRow[mapper_keys['first_name']]);

      if (email != "#ERROR!" && mobile != "#ERROR!" && name != "#ERROR!" && mobile.length == 12) {
        var user = {
          'userId': user_id,
          'email': email,
          'firstName': name,
          'phone': mobile,
          'whatsappOptIn': true,
        };
        userList.push(user);
        userIndexList.push(idx);

        if (userList.length === batchSize) {
          var payload = { "users": userList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
            errorUserList = errorUserList.concat(...userIndexList);
          }

          var userList = [];
          var userIndexList = [];
        }
        if (idx % 50 === 0) {
          print("Delay Added: 5 Sec");
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('User Integrated');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (userList.length > 0) {
    var payload = { "users": userList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
      errorUserList = errorUserList.concat(...userIndexList);
    }
  }

  if (errorUserList.length > 0) {
    print(errorUserList);
    for (var e in errorUserList) {
      webEngageSheet.getRange(parseInt(errorUserList[e]) + StartRow, mapper_keys['status'] + 1).setValue('Failed User Api');
    }
  }

  print("Done User Integration - UPSC_FORM_2");
}

////////////////////////////////////////////////// EVENTS API - UPSC_FORM_2 //////////////////////////////////////////////////

function users_to_events_UPSC2() {
  var mapper_keys = map_keys('Users_to_WE UPSC_FORM_2')
  SpreadsheetApp.flush()

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE UPSC_FORM_2');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var eventName = "UPSC_FA";

  var eventUserList = [];
  var batchSize = 25;

  var userIndexList = [];
  var errorUserList = [];

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status === "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      if (user_id) {
        var eventUser = {
          "userId": user_id,
          "eventName": eventName
        };
        eventUserList.push(eventUser);
        userIndexList.push(idx);

        if (eventUserList.length === batchSize) {
          var payload = { "events": eventUserList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
            errorUserList = errorUserList.concat(...userIndexList);
          }

          var eventUserList = [];
          var userIndexList = [];
        }
        if (idx % 50 === 0) {
          print("Delay Added: 5 Sec");
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Success');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (eventUserList.length > 0) {
    var payload = { "events": eventUserList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
      errorUserList = errorUserList.concat(...userIndexList);
    }
  }

  if (errorUserList.length > 0) {
    print(errorUserList);
    for (var e in errorUserList) {
      webEngageSheet.getRange(parseInt(errorUserList[e]) + StartRow, mapper_keys['status'] + 1).setValue('Failed Event Api');
    }
  }

  print("Done User To Event - UPSC_FORM_2")
}

////////////////////////////////////////////////// USERS API - UPSC_FORM_2 //////////////////////////////////////////////////

function users_to_WE_JUDI() {
  var mapper_keys = map_keys('Users_to_WE JUDI_FORM')
  SpreadsheetApp.flush()

  fetch_users_from_sheet("JUDI_FORM");

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE JUDI_FORM');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var userList = [];
  var batchSize = 25;

  var userIndexList = [];
  var errorUserList = [];

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status !== "Success" && status !== "Error" && status !== "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      var email = String(currentRow[mapper_keys['email']]);
      var mobile = String(currentRow[mapper_keys['phone']]);
      var name = String(currentRow[mapper_keys['first_name']]);

      if (email != "#ERROR!" && mobile != "#ERROR!" && name != "#ERROR!" && mobile.length == 12) {
        var user = {
          'userId': user_id,
          'email': email,
          'firstName': name,
          'phone': mobile,
          'whatsappOptIn': true,
        };
        userList.push(user);
        userIndexList.push(idx);

        if (userList.length === batchSize) {
          var payload = { "users": userList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
            errorUserList = errorUserList.concat(...userIndexList);
          }

          var userList = [];
          var userIndexList = [];
        }
        if (idx % 50 === 0) {
          print("Delay Added: 5 Sec");
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('User Integrated');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (userList.length > 0) {
    var payload = { "users": userList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
      errorUserList = errorUserList.concat(...userIndexList);
    }
  }

  if (errorUserList.length > 0) {
    print(errorUserList);
    for (var e in errorUserList) {
      webEngageSheet.getRange(parseInt(errorUserList[e]) + StartRow, mapper_keys['status'] + 1).setValue('Failed User Api');
    }
  }

  print("Done User Integration - JUDI_FORM");
}

////////////////////////////////////////////////// EVENTS API - JUDI_FORM //////////////////////////////////////////////////

function users_to_events_JUDI() {
  var mapper_keys = map_keys('Users_to_WE JUDI_FORM')
  SpreadsheetApp.flush()

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE JUDI_FORM');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var eventName = "JUDI_FA";

  var eventUserList = [];
  var batchSize = 25;

  var userIndexList = [];
  var errorUserList = [];

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status === "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      if (user_id) {
        var eventUser = {
          "userId": user_id,
          "eventName": eventName
        };
        eventUserList.push(eventUser);
        userIndexList.push(idx);

        if (eventUserList.length === batchSize) {
          var payload = { "events": eventUserList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
            errorUserList = errorUserList.concat(...userIndexList);
          }

          var eventUserList = [];
          var userIndexList = [];
        }
        if (idx % 50 === 0) {
          print("Delay Added: 5 Sec");
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Success');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (eventUserList.length > 0) {
    var payload = { "events": eventUserList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
      errorUserList = errorUserList.concat(...userIndexList);
    }
  }

  if (errorUserList.length > 0) {
    print(errorUserList);
    for (var e in errorUserList) {
      webEngageSheet.getRange(parseInt(errorUserList[e]) + StartRow, mapper_keys['status'] + 1).setValue('Failed Event Api');
    }
  }

  print("Done User To Event - JUDI_FORM")
}

/////////////////////////////////////////////////////////////////////////////// TESTING ///////////////////////////////////////////////////////////////////////////////

function fetchUserData_TEST() {
  var sourceSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("ResponseSheet TEST");
  var destinationSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Users_to_WE TEST");

  var sourceData = sourceSheet.getDataRange().getValues();
  var destinationData = destinationSheet.getDataRange().getValues();

  if (destinationData.length < sourceData.length) {
    var newRows = sourceData.slice(destinationData.length);
    for (var i = 0; i < newRows.length; i++) {
      var row = destinationData.length + i + 1;
      var email = String(newRows[i][1]);
      var phone = String(newRows[i][2]);
      phone = (phone.length === 10) ? "91" + phone : phone;
      var name = String(newRows[i][3]);

      if (email != "#ERROR!" && phone != "#ERROR!" && name != "#ERROR!" && phone.length == 12) {
        var prefix = "test_1_"
        var startCounter = 400000
        var uniqueUserId = generateUserId(row, prefix, startCounter);
        destinationSheet.getRange(row, 1).setValue(uniqueUserId);
        destinationSheet.getRange(row, 2).setValue(email);
        destinationSheet.getRange(row, 3).setValue(phone);
        destinationSheet.getRange(row, 4).setValue(name);
        destinationSheet.getRange(row, 5).setValue("TRUE");
      }
    }
  }
  print("Done Test Fetching!");
}

////////////////////////////////////////////////// USERS API - UPSC_FORM_2 //////////////////////////////////////////////////

function users_to_WE_TEST() {
  var mapper_keys = map_keys('Users_to_WE TEST')
  SpreadsheetApp.flush()

  fetchUserData_TEST();

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE TEST');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var userList = [];
  var batchSize = 25;

  var userIndexList = [];
  var errorUserList = [];

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status !== "Success" && status !== "Error" && status !== "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      var email = String(currentRow[mapper_keys['email']]);
      var mobile = String(currentRow[mapper_keys['phone']]);
      var name = String(currentRow[mapper_keys['first_name']]);

      if (email != "#ERROR!" && mobile != "#ERROR!" && name != "#ERROR!" && mobile.length == 12) {
        var user = {
          'userId': user_id,
          'email': email,
          'firstName': name,
          'phone': mobile,
          'whatsappOptIn': true,
        };
        userList.push(user);
        userIndexList.push(idx);

        if (userList.length === batchSize) {
          var payload = { "users": userList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
            errorUserList = errorUserList.concat(...userIndexList);
          }

          var userList = [];
          var userIndexList = [];
        }
        if (idx % 50 === 0) {
          print("Delay Added: 5 Sec");
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('User Integrated');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (userList.length > 0) {
    var payload = { "users": userList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
      errorUserList = errorUserList.concat(...userIndexList);
    }
  }

  if (errorUserList.length > 0) {
    print(errorUserList);
    for (var e in errorUserList) {
      webEngageSheet.getRange(parseInt(errorUserList[e]) + StartRow, mapper_keys['status'] + 1).setValue('Failed User Api');
    }
  }

  print("Done User Integration - TEST");
}

////////////////////////////////////////////////// EVENTS API - JUDI_FORM //////////////////////////////////////////////////

function users_to_events_TEST() {
  var mapper_keys = map_keys('Users_to_WE TEST')
  SpreadsheetApp.flush()

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE TEST');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var eventName = "Testing User Event";

  var eventUserList = [];
  var batchSize = 25;

  var userIndexList = [];
  var errorUserList = [];

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status === "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      if (user_id) {
        var eventUser = {
          "userId": user_id,
          "eventName": eventName
        };
        eventUserList.push(eventUser);
        userIndexList.push(idx);

        if (eventUserList.length === batchSize) {
          var payload = { "events": eventUserList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
            errorUserList = errorUserList.concat(...userIndexList);
          }

          var eventUserList = [];
          var userIndexList = [];
        }
        if (idx % 50 === 0) {
          print("Delay Added: 5 Sec");
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Success');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (eventUserList.length > 0) {
    var payload = { "events": eventUserList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
      errorUserList = errorUserList.concat(...userIndexList);
    }
  }

  if (errorUserList.length > 0) {
    print(errorUserList);
    for (var e in errorUserList) {
      webEngageSheet.getRange(parseInt(errorUserList[e]) + StartRow, mapper_keys['status'] + 1).setValue('Failed Event Api');
    }
  }

  print("Done User To Event - TEST")
}
class Solution {
    public int longestConsecutive(int[] nums) {
        if(nums.length==0)
            return 0;
        HashSet<Integer>set=new HashSet<Integer>();
        for(int num:nums)
        {
            set.add(num);
        }
        int ans=1;
        for(int num:nums)
        {
            int count=1;
            if(!set.contains(num-1))
            {
                while(set.contains(num+1))
                {
                    num++;
                    count++;
                }
                ans=Math.max(num,count);
            }
        }
        return ans;
    }
}
import os
from google.cloud import storage
import openai
from openai import OpenAI
import requests
from google.oauth2 import service_account

def upload_to_google_cloud(local_file_path, bucket_name, destination_blob_name, credentials_json):
    # Initialize the Google Cloud client
    storage_client = storage.Client.from_service_account_json(credentials_json)
    bucket = storage_client.bucket(bucket_name)
    blob = bucket.blob(destination_blob_name)

    # Upload the file
    blob.upload_from_filename(local_file_path)

    # The public URL can be used to directly access the uploaded file via HTTP
    return blob.public_url

def upload_folder(folder_path, bucket_name, credentials_json):
    urls = []
    for filename in os.listdir(folder_path):
        if filename.lower().endswith(('.png', '.jpg', '.jpeg')):
            local_file_path = os.path.join(folder_path, filename)
            destination_blob_name = filename
            url = upload_to_google_cloud(local_file_path, bucket_name, destination_blob_name, credentials_json)
            urls.append(url)
    return urls

def save_urls_to_file(urls, file_path):
    with open(file_path, 'w') as file:
        for url in urls:
            file.write(url + '\n')
    print(f"URLs saved to {file_path}")

# Example usage
folder_path = 'C:/Users/Cibe/Downloads/apartments'
credentials_json = 'C:/Users/Cibe/Google-Json/credentials.json'
bucket_name = 'monkempire-test-1'

 #Upload the folder and get URLs
#uploaded_urls = upload_folder(folder_path, bucket_name, credentials_json)

 #Save the URLs to a file
#(uploaded_urls, 'uploaded_images_urls.txt')


def read_urls_from_file(file_path):
    with open(file_path, 'r') as file:
        return [line.strip() for line in file.readlines()]


client = OpenAI(api_key='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')


def generate_description(text):
    try:
        response = client.chat.completions.create(
            model="gpt-4-vision-preview",
            messages=[
                {
                    "role": "user",
                    "content": [
                        {"type": "text", "text": "You are a real estate agent, and you want to generate a sales description of the listing based of the pictures."},
                        {
                            "type": "image_url",
                            "image_url": {
                                "url": text,
                            },
                        },
                    ],
                }
            ],
            max_tokens=150,
        )
        return response.choices[0]
    except Exception as e:
            return str(e)


# Example usage
file_path = 'uploaded_image_url.txt'

# Read URLs from the file
#image_urls = read_urls_from_file(file_path)
with open('uploaded_image_url.txt', 'r') as file:
    image_urls = file.read().rstrip()

# Generate and print descriptions for each image
description = generate_description(image_urls)
print(f"Description for the image:\n{description}\n")
import java.util.ArrayList;
import java.util.Scanner;

public class StudentInformationSystem {

    private static ArrayList<Student> students = new ArrayList<>();
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        while (true) {
            displayMenu();
            int choice = scanner.nextInt();
            scanner.nextLine(); // Consume the newline character

            switch (choice) {
                case 1:
                    addStudent();
                    break;
                case 2:
                    viewStudentList();
                    break;
                case 3:
                    searchStudent();
                    break;
                case 4:
                    System.out.println("Exiting program. Goodbye!");
                    System.exit(0);
                default:
                    System.out.println("Invalid choice. Please try again.");
            }
        }
    }

    private static void displayMenu() {
        System.out.println("Student Information System Menu:");
        System.out.println("1. Add Student");
        System.out.println("2. View Student List");
        System.out.println("3. Search for Student");
        System.out.println("4. Exit");
        System.out.print("Enter your choice: ");
    }

    private static void addStudent() {
        System.out.print("Enter student ID: ");
        int id = scanner.nextInt();
        scanner.nextLine(); // Consume the newline character

        System.out.print("Enter student name: ");
        String name = scanner.nextLine();

        students.add(new Student(id, name));
        System.out.println("Student added successfully!");
    }

    private static void viewStudentList() {
        if (students.isEmpty()) {
            System.out.println("No students in the system yet.");
        } else {
            System.out.println("Student List:");
            for (Student student : students) {
                System.out.println("ID: " + student.getId() + ", Name: " + student.getName());
            }
        }
    }

    private static void searchStudent() {
        System.out.print("Enter student ID to search: ");
        int searchId = scanner.nextInt();
        scanner.nextLine(); // Consume the newline character

        boolean found = false;
        for (Student student : students) {
            if (student.getId() == searchId) {
                System.out.println("Student found: ID: " + student.getId() + ", Name: " + student.getName());
                found = true;
                break;
            }
        }

        if (!found) {
            System.out.println("Student with ID " + searchId + " not found.");
        }
    }

    private static class Student {
        private int id;
        private String name;

        public Student(int id, String name) {
            this.id = id;
            this.name = name;
        }

        public int getId() {
            return id;
        }

        public String getName() {
            return name;
        }
    }
}
import java.util.ArrayList;
import java.util.Scanner;

public class StudentInformationSystem {

    private static ArrayList<Student> students = new ArrayList<>();
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        while (true) {
            displayMenu();
            int choice = scanner.nextInt();
            scanner.nextLine(); // Consume the newline character

            switch (choice) {
                case 1:
                    addStudent();
                    break;
                case 2:
                    viewStudentList();
                    break;
                case 3:
                    searchStudent();
                    break;
                case 4:
                    System.out.println("Exiting program. Goodbye!");
                    System.exit(0);
                default:
                    System.out.println("Invalid choice. Please try again.");
            }
        }
    }

    private static void displayMenu() {
        System.out.println("Student Information System Menu:");
        System.out.println("1. Add Student");
        System.out.println("2. View Student List");
        System.out.println("3. Search for Student");
        System.out.println("4. Exit");
        System.out.print("Enter your choice: ");
    }

    private static void addStudent() {
        System.out.print("Enter student ID: ");
        int id = scanner.nextInt();
        scanner.nextLine(); // Consume the newline character

        System.out.print("Enter student name: ");
        String name = scanner.nextLine();

        students.add(new Student(id, name));
        System.out.println("Student added successfully!");
    }

    private static void viewStudentList() {
        if (students.isEmpty()) {
            System.out.println("No students in the system yet.");
        } else {
            System.out.println("Student List:");
            for (Student student : students) {
                System.out.println("ID: " + student.getId() + ", Name: " + student.getName());
            }
        }
    }

    private static void searchStudent() {
        System.out.print("Enter student ID to search: ");
        int searchId = scanner.nextInt();
        scanner.nextLine(); // Consume the newline character

        boolean found = false;
        for (Student student : students) {
            if (student.getId() == searchId) {
                System.out.println("Student found: ID: " + student.getId() + ", Name: " + student.getName());
                found = true;
                break;
            }
        }

        if (!found) {
            System.out.println("Student with ID " + searchId + " not found.");
        }
    }

    private static class Student {
        private int id;
        private String name;

        public Student(int id, String name) {
            this.id = id;
            this.name = name;
        }

        public int getId() {
            return id;
        }

        public String getName() {
            return name;
        }
    }
}
//////////////////////////////// TESTING USER FETCHING FROM ANOTHER SHEET ////////////////////////////////

function fetchUserData_TEST() {
  var sourceSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("ResponseSheet TEST");
  var destinationSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Users_to_WE TEST");

  var sourceData = sourceSheet.getDataRange().getValues();
  var destinationData = destinationSheet.getDataRange().getValues();

  if (destinationData.length < sourceData.length) {
    var newRows = sourceData.slice(destinationData.length);
    for (var i = 0; i < newRows.length; i++) {
      var row = destinationData.length + i + 1; // 1-based index
      var email = newRows[i][1];
      var phone = newRows[i][2];
      phone = (phone.length === 10) ? "91" + phone : phone;
      var name = newRows[i][3];

      if (name && email && phone) {
        var prefix = "test1_"
        var startCounter = 300000
        var uniqueUserId = generateUserId(row, prefix, startCounter);
        destinationSheet.getRange(row, 1).setValue(uniqueUserId);
        destinationSheet.getRange(row, 2).setValue(email);
        destinationSheet.getRange(row, 3).setValue(phone);
        destinationSheet.getRange(row, 4).setValue(name);
        destinationSheet.getRange(row, 5).setValue("TRUE");
      }
    }
  }
  print("Done Test Fetching!");
}

//////////////////////////////// TESTING USER INTEGRATING API ////////////////////////////////

function pushUsersDataToWE_TEST_USERS() {
  var mapper_keys = map_keys('Users_to_WE TEST')
  SpreadsheetApp.flush()

  fetchUserData_TEST();

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE TEST');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var headers = {
    "Authorization": "Bearer " + webEngageApiKey,
    "Content-Type": "application/json"
  }

  var usersUrl = webEngageUrl + "v1/accounts/" + webEngageLicense + "/bulk-users";

  var userList = [];
  var batchSize = 25;

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status !== "Success" && status !== "Error" && status !== "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      var email = String(currentRow[mapper_keys['email']]);
      var mobile = String(currentRow[mapper_keys['phone']]);
      var name = String(currentRow[mapper_keys['first_name']]);

      if (email != "#ERROR!" && mobile != "#ERROR!" && name != "#ERROR!" && mobile.length >= 10) {
        var user = {
          'userId': user_id,
          'email': email,
          'firstName': name,
          'phone': mobile,
          'whatsappOptIn': true,
        };
        userList.push(user)

        if (userList.length === batchSize) {
          var payload = { "users": userList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
          }

          var userList = [];
        }
        if (idx % 100 === 0) {
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('User Integrated');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }
  if (userList.length > 0) {
    var payload = { "users": userList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(usersUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
    }
    print(uploadResponse)
  }

  print("Done Test Integration!");
}

//////////////////////////////// TESTING EVENT API ////////////////////////////////

function pushUsersDataToWE_TEST_EVENTS() {
  var mapper_keys = map_keys('Users_to_WE TEST')
  SpreadsheetApp.flush()

  var webEngageSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Users_to_WE TEST');

  var StartRow = 2;
  var RowRange = webEngageSheet.getLastRow() - StartRow + 1;
  var WholeRange = webEngageSheet.getRange(StartRow, 1, RowRange, 6);
  var AllValues = WholeRange.getDisplayValues();

  var headers = {
    "Authorization": "Bearer " + webEngageApiKey,
    "Content-Type": "application/json"
  }

  var eventUserList = [];
  var batchSize = 25;

  var eventsUrl = webEngageUrl + "v1/accounts/" + webEngageLicense + "/bulk-events";

  var eventName = "Testing User Event 2";

  for (var idx in AllValues) {
    var currentRow = AllValues[idx];
    var status = currentRow[mapper_keys['status']];

    if (status === "User Integrated") {
      var user_id = String(currentRow[mapper_keys['user_id']]);
      if (user_id) {
        var eventUser = {
          "userId": user_id,
          "eventName": eventName
        };
        eventUserList.push(eventUser)

        if (eventUserList.length === batchSize) {
          var payload = { "events": eventUserList }
          payload = JSON.stringify(payload);

          var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

          if (respStatus != 201) {
            print(payload);
            print(respStatus);
          }

          var eventUserList = [];
        }
        if (idx % 100 === 0) {
          Utilities.sleep(5000);
        }
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Success');
      }
      else {
        webEngageSheet.getRange(parseInt(idx) + StartRow, mapper_keys['status'] + 1).setValue('Error');
      }
    }
  }

  if (eventUserList.length > 0) {
    var payload = { "events": eventUserList }
    payload = JSON.stringify(payload);

    var [uploadResponse, respStatus] = callApi(eventsUrl, "post", payload, headers);

    if (respStatus != 201) {
      print(payload);
      print(respStatus);
    }
    print(uploadResponse)
    print(payload)
    print(respStatus)
  }

  print("Done Test Event!")
}
export const statusSql = (alias: string) => {
     return `(select
             CASE WHEN ( ${alias}."ON_TIME_OVERRIDE" = 1) 
                  THEN 'On-time'
                  WHEN ( "spli1"."EARLIEST_FILE_SUBMISSION_DATE" < ${alias}."EXPECTED_DATE" )
                  THEN 'On-time'
                  WHEN ( ( ${alias}."NO_DATA" = 1 ) 
                         AND ( ${alias}."NO_DATA_CREATE_DATE" < ${alias}."EXPECTED_DATE"))
                  THEN 'On-time'
                  WHEN ( ${alias}."EXPECTED_DATE" > SYSTIMESTAMP)
                  THEN 'Pending'
                  ELSE 'Late'
             END
             from SUBMISSION_PERIOD "sp1"
             left join SUBMISSION_PERIOD_LINE_ITEM_V "spli1" on 
                                                     "spli1"."SUBMISSION_PERIOD_SID" = "sp1"."SID"
                                                     AND "spli1"."CUSTOMER_SID" = "sp1"."CUSTOMER_SID"
             where "sp1"."SID" = ${alias}."SID"
             AND "sp1"."CUSTOMER_SID" = ${alias}."CUSTOMER_SID")`;
};

export const reportedFlagSql = (alias: string) => {
     return `(select
             CASE WHEN MAX(${alias}."ON_TIME_OVERRIDE") = 1
                  THEN 1
                  WHEN MAX(${alias}."NO_DATA") = 1
                  THEN 1
                  WHEN COUNT("df"."ID") > 0
                  THEN 1
                  ELSE 0
             END
             from SUBMISSION_SCHEDULE "ss1"
             left join DATA_FILE_SUMMARY_INFO "dfsi" on 
                                              "dfsi"."SUBMISSION_PERIOD_SID" = ${alias}."SID"
                                              AND "dfsi"."CUSTOMER_SID" = ${alias}."CUSTOMER_SID"
             left join DATA_TYPE "dt1" on "ss1"."DATA_TYPE_SID" = "dt1"."SID"
             left join DATA_FILE "df" on "dfsi"."CUSTOMER_SID" = "df"."CUSTOMER_SID"
                                 AND "dfsi"."DATA_FILE_SID" = "df"."SID"
                                 AND "df"."DATA_TYPE" = "dt1"."TYPE"  
             where "ss1"."SID" = ${alias}."SUBMISSION_SCHEDULE_SID"
             AND "ss1"."CUSTOMER_SID" = ${alias}."CUSTOMER_SID")`
};

export const fileIdsSql = (alias: string) => { 
    return `(select
             listagg("df"."ID",',') within group (ORDER BY "df"."CREATE_DATE")
             from SUBMISSION_SCHEDULE "ss1"
             left join DATA_FILE_SUMMARY_INFO "dfsi" on 
                                              "dfsi"."SUBMISSION_PERIOD_SID" = ${alias}."SID"
                                              AND "dfsi"."CUSTOMER_SID" = ${alias}."CUSTOMER_SID"
             left join DATA_TYPE "dt1" on "ss1"."DATA_TYPE_SID" = "dt1"."SID"
             left join DATA_FILE "df" on "dfsi"."CUSTOMER_SID" = "df"."CUSTOMER_SID"
                                 AND "dfsi"."DATA_FILE_SID" = "df"."SID"
                                 AND "df"."DELETED" = 0
                                 AND "df"."DATA_TYPE" = "dt1"."TYPE"  
             where "ss1"."SID" = ${alias}."SUBMISSION_SCHEDULE_SID"
             AND "ss1"."CUSTOMER_SID" = ${alias}."CUSTOMER_SID")`
};

export const filesCountSql = (alias: string) => {
     return `(select
          count(df.id) as number_of_files
          from SUBMISSION_SCHEDULE ss1
          left join DATA_FILE_SUMMARY_INFO dfsi on 
                                           dfsi.SUBMISSION_PERIOD_SID =  ${alias}.SID
                                           AND dfsi.CUSTOMER_SID = ${alias}.CUSTOMER_SID
          left join DATA_TYPE dt1 on ss1.DATA_TYPE_SID = dt1.SID
          left join DATA_FILE df on dfsi.CUSTOMER_SID = df.CUSTOMER_SID
                              AND dfsi.DATA_FILE_SID = df.SID
                              AND df.DELETED = 0
                              AND df.DATA_TYPE = dt1.TYPE
          where ss1.SID = ${alias}.SUBMISSION_SCHEDULE_SID
          AND ss1.CUSTOMER_SID= ${alias}.CUSTOMER_SID)`
}

export const filesDataSql = (alias:string) => {
     return `(select
          df.id
          from SUBMISSION_SCHEDULE ss1
          left join DATA_FILE_SUMMARY_INFO dfsi on 
                                           dfsi.SUBMISSION_PERIOD_SID = ${alias}.SID
                                           AND dfsi.CUSTOMER_SID = ${alias}.CUSTOMER_SID
          left join DATA_TYPE dt1 on ss1.DATA_TYPE_SID = dt1.SID
          left join DATA_FILE df on dfsi.CUSTOMER_SID = df.CUSTOMER_SID
                              AND dfsi.DATA_FILE_SID = df.SID
                              AND df.DELETED = 0
                              AND df.DATA_TYPE = dt1.TYPE
          where ss1.SID = ${alias}.SUBMISSION_SCHEDULE_SID
          AND ss1.CUSTOMER_SID= ${alias}.CUSTOMER_SID
          AND df.id IS NOT NULL)`
}
version: "1.0"

name: ChannelNetwork

# All actions

actions:
  - name: VIEW
  - name: UPDATE

# All resources

resources:
  # UI Resource for access to kpis tab
  - name: ProductKpiTab
    actions: [VIEW]

    ### Begin productKpi fields

  - name: ProductKpi
    group: productKpi
    actions: [VIEW]

  - name: ProductKpi/*
    group: productKpi
    actions: [VIEW]

    ### End productKpi fields

    ### Begin salesKpi fields

  - name: SalesKpi
    group: salesKpi
    actions: [VIEW]

  - name: SalesKpi/*
    group: salesKpi
    actions: [VIEW]

    ### End salesKpi fields

    ### Begin inventoryKpi fields

  - name: InventoryKpi
    group: inventoryKpi
    actions: [VIEW]

  - name: InventoryKpi/*
    group: inventoryKpi
    actions: [VIEW]

    ### End inventoryKpi fields

    ### Begin filesKpi fields

  - name: FilesKpi
    group: filesKpi
    actions: [VIEW]

  - name: FilesKpi/*
    group: filesKpi
    actions: [VIEW]

    ### End filesKpi fields

    ### Begin ssKpi fields

  - name: SSKpi
    group: ssKpi
    actions: [VIEW]

  - name: SSKpi/*
    group: ssKpi
    actions: [VIEW]

    ### End ssKpi fields


    # UI Resource for access to Products tab
  - name: ProductTab
    actions: [VIEW, UPDATE]

    ### Begin Product Fields

  - name: Product
    group: product
    actions: [VIEW, UPDATE]

  - name: Product/sid
    group: product
    actions: [VIEW]

  - name: Product/createDate
    group: product
    actions: [VIEW]

  - name: Product/updateDate
    group: product
    actions: [VIEW]

  - name: Product/customerSid
    group: product-internal
    actions: [VIEW]

  - name: Product/sku
    group: product
    actions: [VIEW]

  - name: Product/name
    group: product
    actions: [VIEW]

  - name: Product/description
    group: product
    actions: [VIEW]

  - name: Product/productFamily
    group: product
    actions: [VIEW]

  - name: Product/productLine
    group: product
    actions: [VIEW]

  - name: Product/startDate
    group: product
    actions: [VIEW]

  - name: Product/endDate
    group: product
    actions: [VIEW]

  - name: Product/serialized
    group: product-internal
    actions: [VIEW]

  - name: Product/aggregation
    group: product-pos-aggr
    actions: [VIEW]

  - name: Product/aggregation/totalSalesLineCount
    group: product-pos-aggr
    actions: [VIEW]

  - name: Product/aggregation/totalSalesQuantity
    group: product-pos-aggr
    actions: [VIEW]

  - name: Product/aggregation/oldestInvoiceDate
    group: product-pos-aggr
    actions: [VIEW]

    ## Begin Product Dynamic Attrs


  - name: Product/dynamicAttrs
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/sid
    group: product-dynamicAttrs-internal
    actions: [VIEW]
  - name: Product/dynamicAttrs/updateDate
    group: product-dynamicAttrs-internal
    actions: [VIEW]
  - name: Product/dynamicAttrs/createDate
    group: product-dynamicAttrs-internal
    actions: [VIEW]
  - name: Product/dynamicAttrs/attributeType
    group: product-dynamicAttrs-internal
    actions: [VIEW]
  - name: Product/dynamicAttrs/STRING_COL_1
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_2
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_3
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_4
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_5
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_6
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_7
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_8
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_9
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_10
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_11
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_12
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_13
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_14
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_15
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_16
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_17
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_18
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_19
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_20
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_21
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_22
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_23
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_24
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_25
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_26
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_27
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_28
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_29
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/STRING_COL_30
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]

  - name: Product/dynamicAttrs/NUM_COL_1
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_2
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_3
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_4
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_5
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_6
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_7
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_8
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_9
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
  - name: Product/dynamicAttrs/NUM_COL_10
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]

  - name: Product/dynamicAttrs/DATE_COL_1
    group: product-dynamicAttrs
    actions: [VIEW, UPDATE]
    ## End Product Dynamic Attrs

    ### End Product Fields

    # UI Resource for access to POS tab
  - name: SalesTab
    actions: [VIEW, UPDATE]

    ### Begin POS Fields

  - name: Sales
    group: sales
    actions: [VIEW, UPDATE]

  - name: Sales/sid
    group: sales
    actions: [VIEW]

  - name: Sales/createDate
    group: sales
    actions: [VIEW]

  - name: Sales/updateDate
    group: sales
    actions: [VIEW]

  - name: Sales/customerSid
    group: sales-internal
    actions: [VIEW]

  - name: Sales/deleted
    group: sales-internal
    actions: [VIEW]

  - name: Sales/branchId
    group: sales
    actions: [VIEW]

  - name: Sales/invoiceNumber
    group: sales
    actions: [VIEW]

  - name: Sales/invoiceDate
    group: sales
    actions: [VIEW]

  - name: Sales/quantity
    group: sales
    actions: [VIEW]

  - name: Sales/reportedSku
    group: sales
    actions: [VIEW, UPDATE]

  - name: Sales/productDescription
    group: sales
    actions: [VIEW]

  - name: Sales/transactionId
    group: sales-internal
    actions: [VIEW]

  - name: Sales/vendorPartNumber
    group: sales
    actions: [VIEW]

  - name: Sales/accountRepresentative
    group: sales
    actions: [VIEW]

  - name: Sales/acquisitionExtendedPrice
    group: sales
    actions: [VIEW]

  - name: Sales/acquisitionUnitPrice
    group: sales
    actions: [VIEW]

  - name: Sales/boolExtendedPrice
    group: sales
    actions: [VIEW]

  - name: Sales/bookUnitPrice
    group: sales
    actions: [VIEW]

  - name: Sales/customerOrderNumber
    group: sales
    actions: [VIEW]

  - name: Sales/debitExtendedPrice
    group: sales
    actions: [VIEW]

  - name: Sales/debitUnitPrice
    group: sales
    actions: [VIEW]

  - name: Sales/designRegistrationNumber
    group: sales
    actions: [VIEW]

  - name: Sales/distributorId
    group: sales
    actions: [VIEW]

  - name: Sales/distributorName
    group: sales
    actions: [VIEW]

  - name: Sales/distributorShipmentNumber
    group: sales
    actions: [VIEW]

  - name: Sales/distributorWarehouseId
    group: sales
    actions: [VIEW]

  - name: Sales/exchangeDate
    group: sales
    actions: [VIEW]

  - name: Sales/exchangeRate
    group: sales
    actions: [VIEW]

  - name: Sales/globalProductClassCode
    group: sales
    actions: [VIEW]

  - name: Sales/legacySalesRecordId
    group: sales
    actions: [VIEW]

  - name: Sales/lengthOfProduction
    group: sales
    actions: [VIEW]

  - name: Sales/manufactureId
    group: sales
    actions: [VIEW]

  - name: Sales/manufactureName
    group: sales
    actions: [VIEW]

  - name: Sales/manufacturerShipmentNumber
    group: sales
    actions: [VIEW]

  - name: Sales/orderNumber
    group: sales
    actions: [VIEW]

  - name: Sales/originalId
    group: sales
    actions: [VIEW]

  - name: Sales/price
    group: sales
    actions: [VIEW]

  - name: Sales/purchaseOrderNumber
    group: sales
    actions: [VIEW]

  - name: Sales/r2rDuplicateType
    group: sales
    actions: [VIEW]

  - name: Sales/regionTerritory
    group: sales
    actions: [VIEW]

  - name: Sales/reportEndingDate
    group: sales
    actions: [VIEW]

  - name: Sales/reportType
    group: sales
    actions: [VIEW]

  - name: Sales/resaleExtendedPrice
    group: sales
    actions: [VIEW]

  - name: Sales/resaeExtension
    group: sales
    actions: [VIEW]

  - name: Sales/resaleUnitPrice
    group: sales
    actions: [VIEW]

  - name: Sales/resubmitted
    group: sales
    actions: [VIEW]

  - name: Sales/reportedProductFamily
    group: sales
    actions: [VIEW]

  - name: Sales/reportedProductLine
    group: sales
    actions: [VIEW]

  - name: Sales/reportedProductName
    group: sales
    actions: [VIEW]

  - name: Sales/shipDate
    group: sales
    actions: [VIEW]

  - name: Sales/shipDebitNumber
    group: sales
    actions: [VIEW]

  - name: Sales/shippingMethod
    group: sales
    actions: [VIEW]

  - name: Sales/spaNumber
    group: sales
    actions: [VIEW]

  - name: Sales/tier
    group: sales
    actions: [VIEW]

  - name: Sales/transactionType
    group: sales
    actions: [VIEW]

  - name: Sales/unitOfMeasure
    group: sales
    actions: [VIEW]

  - name: Sales/vendorPartDescription
    group: sales
    actions: [VIEW]

  - name: Sales/validationCodes
    group: sales
    actions: [VIEW]

  - name: Sales/serialNumbers
    group: sales
    actions: [VIEW]

    # Bill to address


  - name: Sales/billToAddress
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/billToAddress/entityName
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/street1
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/street2
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/city
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/stateProvince
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/postalCode
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/reportedCountry
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/country
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/country/name
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/country/twoCharCode
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddress/country/threeCharCode
    group: sales-bill-to
    actions: [VIEW]

  - name: Sales/billToAddressExternalId
    group: sales-bill-to
    actions: [VIEW]

    # sold to address

  - name: Sales/soldToAddress
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/soldToAddress/entityName
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/street1
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/street2
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/city
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/stateProvince
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/postalCode
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/reportedCountry
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/country
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/country/name
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/country/twoCharCode
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddress/country/threeCharCode
    group: sales-sold-to
    actions: [VIEW]

  - name: Sales/soldToAddressExternalId
    group: sales-sold-to
    actions: [VIEW]

    # ship to address

  - name: Sales/shipToAddress
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/shipToAddress/entityName
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/street1
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/street2
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/city
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/stateProvince
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/postalCode
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/reportedCountry
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/country
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/country/name
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/country/twoCharCode
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddress/country/threeCharCode
    group: sales-ship-to
    actions: [VIEW]

  - name: Sales/shipToAddressExternalId
    group: sales-ship-to
    actions: [VIEW]

    # sell from address

  - name: Sales/sellFromAddress
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/sellFromAddress/entityName
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/street1
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/street2
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/city
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/stateProvince
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/postalCode
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/reportedCountry
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/country
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/country/name
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/country/twoCharCode
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddress/country/threeCharCode
    group: sales-sell-from
    actions: [VIEW]

  - name: Sales/sellFromAddressExternalId
    group: sales-sell-from
    actions: [VIEW]

    # ship from address

  - name: Sales/shipFromAddress
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/shipFromAddress/entityName
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/street1
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/street2
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/city
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/stateProvince
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/postalCode
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/reportedCountry
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/country
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/country/name
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/country/twoCharCode
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddress/country/threeCharCode
    group: sales-ship-from
    actions: [VIEW]

  - name: Sales/shipFromAddressExternalId
    group: sales-ship-from
    actions: [VIEW]

    # sales in address

  - name: Sales/salesInAddress
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/salesInAddress/entityName
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/street1
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/street2
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/city
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/stateProvince
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/postalCode
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/reportedCountry
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/country
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/country/name
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/country/twoCharCode
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddress/country/threeCharCode
    group: sales-sales-in
    actions: [VIEW]

  - name: Sales/salesInAddressExternalId
    group: sales-sales-in
    actions: [VIEW]

    # purchasing customer address

  - name: Sales/purchasingCustomerAddress
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/entityName
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/street1
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/street2
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/city
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/stateProvince
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/postalCode
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/reportedCountry
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/country
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/country/name
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/country/twoCharCode
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerAddress/country/threeCharCode
    group: sales-purchasing-customer
    actions: [VIEW]

  - name: Sales/purchasingCustomerExternalId
    group: sales-purchasing-customer
    actions: [VIEW]

    # derived end customer address

  - name: Sales/derivedEndCustomerAddress
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/entityName
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/street1
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/street2
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/city
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/stateProvince
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/postalCode
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/reportedCountry
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/country
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/country/name
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/country/twoCharCode
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddress/country/threeCharCode
    group: sales-derived-end-customer
    actions: [VIEW]

  - name: Sales/derivedEndCustomerAddressExternalId
    group: sales-derived-end-customer
    actions: [VIEW]

    # data file

  - name: Sales/dataFile
    group: sales-data-file
    actions: [VIEW]

  - name: Sales/dataFile/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/dataFile/loadDate
    group: sales-data-file
    actions: [VIEW]

  - name: Sales/dataFile/reportDate
    group: sales-data-file
    actions: [VIEW]

  - name: Sales/dataFile/id
    group: sales-data-file
    actions: [VIEW]

  - name: Sales/dataFile/fileName
    group: sales-data-file
    actions: [VIEW]

  - name: Sales/dataFile/recordCount
    group: sales-data-file
    actions: [VIEW]

    # match info

  - name: Sales/productMatchInfo
    group: sales-product-match-info
    actions: [VIEW]

  - name: Sales/productMatchInfo/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/productMatchInfo/matchedProduct
    group: sales-product-match-info
    actions: [VIEW]

  - name: Sales/productMatchInfo/matchedProduct/sku
    group: sales-product-match-info
    actions: [VIEW]

    # reporting partner

  - name: Sales/reportingPartner
    group: sales-reporting-partner
    actions: [VIEW]

  - name: Sales/reportingPartner/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/reportingPartner/gsNumbers
    group: sales-reporting-partner
    actions: [VIEW]

  - name: Sales/reportingPartner/gsNumbers/value
    group: sales-reporting-partner
    actions: [VIEW]

    # currency

  - name: Sales/currency
    group: sales-currency
    actions: [VIEW]

  - name: Sales/currency/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/currency/name
    group: sales-currency
    actions: [VIEW]

    # resale currency

  - name: Sales/resaleCurrency
    group: sales-resale-currency
    actions: [VIEW]

  - name: Sales/resaleCurrency/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/resaleCurrency/name
    group: sales-resale-currency
    actions: [VIEW]

    # debit currency

  - name: Sales/debtCurrency
    group: sales-debit-currency
    actions: [VIEW]

  - name: Sales/debtCurrency/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/debtCurrency/name
    group: sales-debit-currency
    actions: [VIEW]

    # book currency

  - name: Sales/bookCurrency
    group: sales-book-currency
    actions: [VIEW]

  - name: Sales/bookCurrency/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/bookCurrency/name
    group: sales-book-currency
    actions: [VIEW]

    # acquisition currency

  - name: Sales/acquisitionCurrency
    group: sales-acquisition-currency
    actions: [VIEW]

  - name: Sales/acquisitionCurrency/*
    group: sales-internal
    actions: [VIEW]

  - name: Sales/acquisitionCurrency/name
    group: sales-acquisition-currency
    actions: [VIEW]

    ## Begin POS Dynamic Attrs

  - name: Sales/dynamicAttrs
    group: sales-dynamic-attrs
    actions: [VIEW, UPDATE]

  - name: Sales/dynamicAttrs/*
    group: sales-dynamic-attrs
    actions: [VIEW, UPDATE]

  - name: Sales/dynamicAttrs/STRING_COL_1
    group: sales-dynamic-attrs
    actions: [VIEW, UPDATE]

    ## End POS Dynamic Attrs

    ### End POS Fields

    # UI Resource for access to INV tab
  - name: InventoryTab
    actions: [VIEW, UPDATE]

    ### Begin INV Fields

  - name: Inventory
    group: inventory
    actions: [VIEW, UPDATE]

  - name: Inventory/sid
    group: inventory
    actions: [VIEW]

  - name: Inventory/createDate
    group: inventory
    actions: [VIEW]

  - name: Inventory/updateDate
    group: inventory
    actions: [VIEW]

  - name: Inventory/customerSid
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/deleted
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/productName
    group: inventory
    actions: [VIEW]

  - name: Inventory/clientDescription
    group: inventory
    actions: [VIEW]

  - name: Inventory/clientSku
    group: inventory
    actions: [VIEW, UPDATE]

  - name: Inventory/reportedSku
    group: inventory
    actions: [VIEW]

  - name: Inventory/inventoryDate
    group: inventory
    actions: [VIEW]

  - name: Inventory/unitOfMeasure
    group: inventory
    actions: [VIEW]

  - name: Inventory/id
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/originalId
    group: inventory
    actions: [VIEW]

  - name: Inventory/lineNumber
    group: inventory-internal
    actions: [VIEW]

    # data file

  - name: Inventory/dataFile
    group: inventory-data-file
    actions: [VIEW]

  - name: Inventory/dataFile/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/dataFile/loadDate
    group: inventory-data-file
    actions: [VIEW]

  - name: Inventory/dataFile/reportDate
    group: inventory-data-file
    actions: [VIEW]

  - name: Inventory/dataFile/id
    group: inventory-data-file
    actions: [VIEW]

  - name: Inventory/dataFile/fileName
    group: inventory-data-file
    actions: [VIEW]

  - name: Inventory/dataFile/recordCount
    group: inventory-data-file
    actions: [VIEW]

    # reporting partner

  - name: Inventory/reportingPartner
    group: inventory-reporting-partner
    actions: [VIEW]

  - name: Inventory/reportingPartner/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/reportingPartner/gsNumbers
    group: inventory-reporting-partner
    actions: [VIEW]

  - name: Inventory/reportingPartner/gsNumbers/value
    group: inventory-reporting-partner
    actions: [VIEW]

    # submission period

  - name: Inventory/submissionPeriod
    group: inventory-submission-period
    actions: [VIEW]

  - name: Inventory/submissionPeriod/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/submissionPeriod/expectedDate
    group: inventory-submission-period
    actions: [VIEW]

  - name: Inventory/submissionPeriod/periodStartDate
    group: inventory-submission-period
    actions: [VIEW]

  - name: Inventory/submissionPeriod/periodEndDate
    group: inventory-submission-period
    actions: [VIEW]

    # quantities

  - name: Inventory/inventoryQuantities
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/inventoryQuantities/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/onHandQuantity
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/onHandQuantity/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/onHandQuantity/value
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/onOrderQuantity
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/onOrderQuantity/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/onOrderQuantity/value
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/committedQuantity
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/committedQuantity/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/committedQuantity/value
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/floatQuantity
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/floatQuantity/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/floatQuantity/value
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/backorderedQuantity
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/backorderedQuantity/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/backorderedQuantity/value
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/returnedQuantity
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/returnedQuantity/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/returnedQuantity/value
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/inTransitQuantity
    group: inventory-quantity
    actions: [VIEW]

  - name: Inventory/inTransitQuantity/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/inTransitQuantity/value
    group: inventory-quantity
    actions: [VIEW]

    # prices

  - name: Inventory/inventoryPrices
    group: inventory-price
    actions: [VIEW]

  - name: Inventory/inventoryPrices/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/unitPrice
    group: inventory-price
    actions: [VIEW]

  - name: Inventory/unitPrice/*
    group: inventory-internal
    actions: [VIEW]

  - name: Inventory/unitPrice/price
    group: inventory-price
    actions: [VIEW]

  - name: Inventory/unitPrice/fromCurrency
    group: inventory-price
    actions: [VIEW]

  - name: Inventory/unitPrice/fromCurrency/name
    group: inventory-price
    actions: [VIEW]

  - name: Inventory/unitPrice/toCurrency
    group: inventory-price
    actions: [VIEW]

  - name: Inventory/unitPrice/toCurrency/name
    group: inventory-price
    actions: [VIEW]

    ## Begin INV Dynamic Attrs

  - name: Inventory/dynamicAttrs
    group: inventory-dynamic-attrs
    actions: [VIEW]

  - name: Inventory/dynamicAttrs/*
    group: inventory-dynamic-attrs
    actions: [VIEW]

    ## End INV Dynamic Attrs

    ### End INV Fields

  # UI Resource for access to File Tab
  - name: FilesTab
    actions: [VIEW, UPDATE]

  ## Begin Partner

  - name: Partner
    group: reporting-partner
    actions: [VIEW]

  - name: Partner/*
    group: reporting-partner
    actions: [VIEW]

  ## End Partner

  # Begin File fields
  - name: DataFile
    group: file-management
    actions: [VIEW, UPDATE]

  - name: DataFile/sid
    group: file-management
    actions: [VIEW]

  - name: DataFile/loadDate
    group: file-management
    actions: [VIEW]

  - name: DataFile/reportDate
    group: file-management
    actions: [VIEW]

  - name: DataFile/fileName
    group: file-management
    actions: [VIEW]

  - name: DataFile/fileType
    group: file-management
    actions: [VIEW]

  - name: DataFile/dataType
    group: file-management
    actions: [VIEW]

  - name: DataFile/id
    group: file-management
    actions: [VIEW]

  - name: DataFile/fileSize
    group: file-management
    actions: [VIEW]

  - name: DataFile/source
    group: file-management
    actions: [VIEW]

  - name: DataFile/recordCount
    group: file-management
    actions: [VIEW]

  - name: DataFile/deletedLines
    group: file-management
    actions: [VIEW]

  - name: DataFile/download
    group: file-download
    actions: [VIEW]

  - name: DataFile/validationDownload
    group: file-validation-download
    actions: [VIEW]

  - name: DataFile/upload
    group: file-upload
    actions: [VIEW]

  - name: DataFile/uploadDataTypes
    group: file-upload
    actions: [VIEW]

  - name: DataFile/uploadFileTypes
    group: file-upload
    actions: [VIEW]

  - name: DataFile/reportingPartner
    group: file-reporting-partner
    actions: [VIEW]

  - name: DataFile/reportingPartner/*
    group: file-reporting-partner
    actions: [VIEW]

  - name: DataFile/reportingPartner/partnerOverlayView
    group: file-reporting-partner
    actions: [VIEW]

  - name: DataFile/reportingPartner/partnerOverlayView/*
    group: file-reporting-partner
    actions: [VIEW]

  - name: DataFile/dataFileState
    group: file-data-file-state
    actions: [VIEW]

  - name: DataFile/dataFileState/*
    group: file-data-file-state
    actions: [VIEW]

  - name: DataFile/dataFileState/sid
    group: file-data-file-state
    actions: [VIEW]

  - name: DataFile/dataFileState/createDate
    group: file-data-file-state
    actions: [VIEW]

  - name: DataFile/dataFileState/updateDate
    group: file-data-file-state
    actions: [VIEW]

  - name: DataFile/parserAttempt
    group: file-parser-attempt
    actions: [VIEW]

  - name: DataFile/parserAttempt/*
    group: file-parser-attempt
    actions: [VIEW]

  # End of File fields
  
  # UI Resource for access to Submission Schedule
  - name: SubmissionTrackingTab
    actions: [VIEW, UPDATE]

  - name: SubmissionResultsTab
    actions: [VIEW, UPDATE]

  # Begin Submission Schedule 
  - name: SubmissionSchedule
    group: submission-schedule
    actions: [VIEW, UPDATE]

  - name: SubmissionSchedule/sid
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/createDate
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/updateDate
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/name
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/reportingPartner
    group: ss-reporting-partner
    actions: [VIEW]

  - name: SubmissionSchedule/reportingPartner/*
    group: ss-reporting-partner
    actions: [VIEW]

  - name: SubmissionSchedule/reportingPartner/partnerOverlayView
    group: ss-reporting-partner
    actions: [VIEW]

  - name: SubmissionSchedule/reportingPartner/partnerOverlayView/*
    group: ss-reporting-partner
    actions: [VIEW]

  - name: SubmissionSchedule/dataType
    group: ss-data-type
    actions: [VIEW]

  - name: SubmissionSchedule/dataType/*
    group: ss-data-type
    actions: [VIEW]

  - name: SubmissionSchedule/periodRule
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/expectedDay
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/startDate
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/endDate
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/isInPeriodReporter
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/weekOfMonth
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/monthOfQuarter
    group: submission-schedule
    actions: [VIEW]

  - name: SubmissionSchedule/workingDays
    group: submission-schedule
    actions: [VIEW]

  # End Submission Schedule 

  # Begin Submission Schedule Notification
  - name: SubmissionScheduleNotification
    group: submission-schedule-notification
    actions: [VIEW]
  
  - name: SubmissionScheduleNotification/*
    group: submission-schedule-notification
    actions: [VIEW]

  - name: SubmissionScheduleNotification/notificationType
    group: submission-schedule-notification
    actions: [VIEW]

  - name: SubmissionScheduleNotification/notificationType/*
    group: submission-schedule-notification
    actions: [VIEW]

  - name: SubmissionScheduleNotification/serviceUser
    group: submission-schedule-notification
    actions: [VIEW]

  - name: SubmissionScheduleNotification/serviceUser/*
    group: submission-schedule-notification
    actions: [VIEW]

  # END Submission Schedule Notification

  # Begin Submission Period
  - name: SubmissionPeriod
    group: submission-period-update
    actions: [VIEW, UPDATE]

  - name: SubmissionPeriod/sid
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/expectedDate
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/periodStartDate
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/periodEndDate
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/createDate
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/updateDate
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/noData
    group: submission-period-update
    actions: [VIEW, UPDATE]

  - name: SubmissionPeriod/noDataReason
    group: submission-period-update
    actions: [VIEW, UPDATE]

  - name: SubmissionPeriod/noDataCreateDate
    group: submission-period-update
    actions: [VIEW, UPDATE]

  - name: SubmissionPeriod/onTimeOverride
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/expectedDay
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/workingDays
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/isInPeriodReporter
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/trackingLevel
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/status
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/reportedFlag
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/fileIds
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/firstFileName
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/firstFileCreateDate
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/firstFileId
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/deleted
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/noDataServiceUser
    group: submission-period-update
    actions: [VIEW, UPDATE]

  - name: SubmissionPeriod/noDataServiceUser/sid
    group: sp-no-data-user
    actions: [VIEW]

  - name: SubmissionPeriod/noDataServiceUser/firstName
    group: sp-no-data-user
    actions: [VIEW]

  - name: SubmissionPeriod/noDataServiceUser/lastName
    group: sp-no-data-user
    actions: [VIEW]

  - name: SubmissionPeriod/noDataServiceUser/email
    group: sp-no-data-user
    actions: [VIEW]

  - name: SubmissionPeriod/submissionPeriodLineItemView
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/submissionPeriodLineItemView/*
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/dataFileSummaryInfo
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/dataFileSummaryInfo/*
    group: submission-period
    actions: [VIEW]
    
  - name: SubmissionPeriod/submissionSchedule
    group: submission-period
    actions: [VIEW]
    
  - name: SubmissionPeriod/submissionSchedule/sid
    group: submission-period
    actions: [VIEW]
    
  - name: SubmissionPeriod/submissionSchedule/name
    group: submission-period
    actions: [VIEW]
    
  - name: SubmissionPeriod/submissionSchedule/periodRule
    group: submission-period
    actions: [VIEW]

  - name: SubmissionPeriod/submissionSchedule/reportingPartner
    group: sp-reporting-partner
    actions: [VIEW]

  - name: SubmissionPeriod/submissionSchedule/reportingPartner/*
    group: sp-reporting-partner
    actions: [VIEW]

  - name: SubmissionPeriod/submissionSchedule/reportingPartner/partnerOverlayView
    group: sp-reporting-partner
    actions: [VIEW]

  - name: SubmissionPeriod/submissionSchedule/reportingPartner/partnerOverlayView/*
    group: sp-reporting-partner
    actions: [VIEW]

  - name: SubmissionPeriod/submissionSchedule/dataType
    group: sp-data-type
    actions: [VIEW]

  - name: SubmissionPeriod/submissionSchedule/dataType/*
    group: sp-data-type
    actions: [VIEW]

  # End Submission Period

  # Begin Export Request

  - name: ExportRequest
    group: export
    actions: [VIEW, UPDATE]

  - name: ExportRequest/*
    group: export
    actions: [VIEW, UPDATE]

  # End Export Request

  ### Begin Base resources

  - name: About
    group: about
    actions: [VIEW]

  - name: About/*
    group: about
    actions: [VIEW]

  - name: UserEvent
    group: user-event
    actions: [VIEW, UPDATE]

  - name: UserEvent/*
    group: user-event
    actions: [VIEW, UPDATE]

  - name: ObjectLock
    group: object-lock
    actions: [VIEW, UPDATE]

  - name: ObjectLock/*
    group: object-lock
    actions: [VIEW, UPDATE]

  - name: ObjectLockResponse
    group: object-lock-response
    actions: [VIEW]

  - name: ObjectLockResponse/*
    group: object-lock-response
    actions: [VIEW]

  - name: MutationResponse
    group: mutation-response
    actions: [VIEW]

  - name: MutationResponse/*
    group: mutation-response
    actions: [VIEW]

  - name: DynamicAttrMetadata
    group: attr-metadata
    actions: [VIEW]

  - name: DynamicAttrMetadata/*
    group: attr-metadata
    actions: [VIEW]
    

  ### End Base resources

  ### Begin mutation resources

  - name: Product/mutation/*
    group: product-update
    actions: [UPDATE]

  - name: Sales/mutation/*
    group: sales-update
    actions: [UPDATE]

  - name: Inventory/mutation/*
    group: inventory-update
    actions: [UPDATE]

  - name: ExportRequest/mutation/*
    group: export
    actions: [UPDATE]

  - name: SubmissionPeriod/mutation/*
    group: submission-period-mutation
    actions: [UPDATE]

    ### End mutation resources

    ### Begin Customer Resources

  - name: INT
    actions: [VIEW]

  - name: ACS
    actions: [VIEW]

  - name: CAMB
    actions: [VIEW]

  - name: CYBERDYNE
    actions: [VIEW]

  - name: COR
    actions: [VIEW]

  - name: INT_CCD
    actions: [VIEW]

  - name: ACS_CCD
    actions: [VIEW]

  - name: CAMB_CCD
    actions: [VIEW]

  - name: QCOM_CCD
    actions: [VIEW]

  - name: COR_CCD
    actions: [VIEW]

    ### End Customer Resources

# Common permissions for all tenants
permissions:

  - name: BasicViewUpdate
    displayName: Background Permissions
    description: Every User needs this permission
    resource-actions:
      - about:[VIEW]
      - user-event:[VIEW, UPDATE]
      - object-lock:[VIEW, UPDATE]
      - object-lock-response:[VIEW]
      - mutation-response:[VIEW]
      - attr-metadata:[VIEW]

  - name: KpiView
    displayName: KPI Tab
    description: KPI Permission Set
    resource-actions:
      - ProductKpiTab:[VIEW]

  - name: SSKpiFields
    displayName: Submission KPI Fields
    description: Submission KPI Fields Permission Set
    resource-actions:
      - ssKpi:[VIEW]

  - name: FilesKpiFields
    displayName: Files KPI Fields
    description: Files KPI Fields Permission Set
    resource-actions:
      - filesKpi:[VIEW]

  - name: FileTab
    displayName: File Tab
    description: File Permission Set
    resource-actions:
      - FilesTab:[VIEW]

  - name: FileUploadPartner
    displayName: File Upload for Partner
    description: File Upload Permission Set
    resource-actions:
      - DataFile:[VIEW, UPDATE] 
      - file-upload:[VIEW]     

  - name: FileUpload
    displayName: File Upload 
    description: File Upload Permission Set
    resource-actions:
      - DataFile:[VIEW]
      - file-upload:[VIEW]
      - reporting-partner:[VIEW]

  - name: FileDownload
    displayName: File Download
    description: File Download Permission Set
    resource-actions:
      - DataFile:[VIEW]
      - file-download:[VIEW]
      - file-validation-download:[VIEW]

  - name: SubmissionTab
    displayName: Submission Tab
    description: File Permission Set
    resource-actions:
      - SubmissionTrackingTab:[VIEW]
      - SubmissionResultsTab:[VIEW]

  - name: FileManufactureView
    displayName: File Admin View
    description: File Admin Permission Set
    resource-actions:
      - file-management:[VIEW]
      - file-reporting-partner:[VIEW]
      - file-data-file-state:[VIEW]
      - file-parser-attempt:[VIEW]

  - name: FilePartnerView
    displayName: File Partner View
    description: File Partner Permission Set
    resource-actions:
      - file-management:[VIEW]
      - file-data-file-state:[VIEW]
      - file-parser-attempt:[VIEW]

  - name: SubmissionManufactureView
    displayName: Submission Admin View
    description: Submission Full Permission Set
    resource-actions:
      - submission-schedule:[VIEW]
      - submission-schedule-notification:[VIEW]
      - ss-reporting-partner:[VIEW]
      - ss-data-type:[VIEW]
      - submission-period:[VIEW]
      - sp-reporting-partner:[VIEW]
      - sp-data-type:[VIEW]
      - sp-no-data-user:[VIEW]
      - submission-period-update:[VIEW]

  - name: SubmissionPartnerView
    displayName: Submission Partner View
    description: Submission Full Permission Set
    resource-actions:
      - submission-schedule:[VIEW]
      - submission-schedule-notification:[VIEW]
      - ss-data-type:[VIEW]
      - submission-period:[VIEW]
      - sp-data-type:[VIEW]
      - sp-no-data-user:[VIEW]
      - submission-period-update:[VIEW]

  - name: SubmissionPartnerUpdate
    displayName: Submission Partner Update
    description: Submission Update Permission Set
    resource-actions:
      - submission-period-update:[UPDATE]
      - submission-period-mutation:[UPDATE]

  - name: SubmissionUpdate
    displayName: Submission Update 
    description: Submission Update Permission Set
    resource-actions:
      - submission-period-update:[UPDATE]
      - submission-period-mutation:[UPDATE]
export const SubmissionDef = `
  type Query {
    submissionPeriods(
      offset: Float, 
      limit: Float,
      filters: SubmissionPeriodFilters,
      sort: SubmissionPeriodSort
    ): [SubmissionPeriod]
    submissionSchedules(
      offset: Float, 
      limit: Float,
      filters: SubmissionScheduleFilters, 
      sort: SubmissionScheduleSort
    ): [SubmissionSchedule]
    submissionScheduleNotifications(
      submissionScheduleSid: ID,
      offset: Float,
      limit: Float,
      filters: SubmissionScheduleNotificationFilters,
      sort: SubmissionScheduleNotificationSort
    ): [SubmissionScheduleNotification]
  }

  type Mutation {
    markNoData(data: [NoDataInput]): [MutationResponse] @auth(object: SubmissionPeriod)
  }

  type SubmissionPeriod {
    sid: ID
    createDate: Date
    updateDate: Date
    customerSid: ID
    expectedDate: Date
    periodStartDate: Date
    periodEndDate: Date
    noData: Boolean
    noDataReason: String
    noDataCreateDate: Date
    onTimeOverride: Boolean
    expectedDay: String
    workingDays: String
    isInPeriodReporter: Float
    trackingLevel: String
    submissionSchedule: SubmissionSchedule
    status: String
    reportedFlag: Boolean
    numberOfFiles: Float
    dataFileSummaryInfo: [DataFileSummaryInfo]
    submissionPeriodInfoView: SubmissionPeriodInfoView
    submissionPeriodLineItemView: SubmissionPeriodLineItemView
    noDataServiceUser: ServiceUser
  }

  type SubmissionPeriodLineItemView {
    salesLineItemCount: Float
    invLineItemCount: Float
    earliestFileSubmissionDate: Date
  }

  type SubmissionPeriodInfoView {
    numberOfInventoryLines: Float
    numberOfPOSLines:Float
    fileName: String
    fileId: Float
  }

  type DataFileSummaryInfo{
    numberOfPOSLines: Float
    numberOfInventoryLines: Float
    receivedDate: Date
    dataFileId: String
    dataFileName: String
  }
  
  type SubmissionSchedule {
    sid: ID
    createDate: Date
    updateDate: Date
    customerSid: ID
    dataType: DataType    
    reportingPartner: Partner
    periodRule: String
    name: String
    startDate: Date
    endDate: Date
    expectedDay: String
    workingDays: String
    isInPeriodReporter: Boolean
    weekOfMonth: Float
    monthOfQuarter: Float
  }

  type DataType {
    sid: ID
    createDate: Date
    updateDate: Date
    type: String
  }

  type SubmissionScheduleNotification {
    sid: ID
    createDate: Date
    updateDate: Date
    customerSid: ID
    submissionScheduleSid: ID
    notificationType: NotificationType
    serviceUser: ServiceUser
  }

  enum NotificationType {
    PARSE_SUCCESS
    LATE
    PARSE_FAIL
    EXPECTED
  }

  input SubmissionPeriodFilters {
    sid: IDFilter
    createDate: DateFilter
    updateDate: DateFilter
    customerSid: IDFilter
    expectedDate: DateFilter
    periodStartDate: DateFilter
    periodEndDate: DateFilter
    noDataCreateDate: DateFilter
    submissionSchedule: SubmissionScheduleFilters
    status: StringFilter
    reportedFlag: BooleanFilter
    submissionPeriodLineItemView: SubmissionPeriodLineItemViewFilter
    dataFileSummaryInfo: DataFileSummaryInfoFilter
    numberOfFiles: NumberFilter
  }
  
  input SubmissionPeriodLineItemViewFilter {
    salesLineItemCount: NumberFilter
    invLineItemCount: NumberFilter
    earliestFileSubmissionDate: DateFilter
  }

  input DataFileSummaryInfoFilter{
    numberOfPOSLines: NumberFilter
    numberOfInventoryLines: NumberFilter
    submissionPeriodSid: NumberFilter
    dataFileSid: NumberFilter
    receivedDate: DateFilter
    fileCreateDate: DateFilter
  }

  input SubmissionScheduleFilters {
    sid: IDFilter
    createDate: DateFilter
    updateDate: DateFilter
    customerSid: IDFilter
    reportingPartner: PartnerFilter
    name: StringFilter
    dataType: DataTypeFilter
    periodRule: StringFilter
    expectedDay: StringFilter
    workingDays: StringFilter
    startDate: DateFilter
    endDate: DateFilter
    isInPeriodReporter: BooleanFilter
    weekOfMonth: NumberFilter
    monthOfQuarter: NumberFilter
  }

  input DataTypeFilter {
    sid: IDFilter
    createDate: DateFilter
    updateDate: DateFilter
    type: StringFilter
  }

  input SubmissionScheduleNotificationFilters {
    sid: IDFilter
    createDate: DateFilter
    updateDate: DateFilter
    customerSid: IDFilter
    submissionScheduleSid: IDFilter
    notificationType: StringFilter
    serviceUser: ServiceUserFilters
  }

  input SubmissionPeriodSort {
    sid: SortOption
    createDate: SortOption
    updateDate: SortOption
    expectedDate: SortOption
    periodStartDate: SortOption
    periodEndDate: SortOption
    noDataCreateDate: SortOption
    submissionSchedule: SubmissionScheduleSort
    status: SortOption
    reportedFlag: SortOption
    submissionPeriodLineItemView: SubmissionPeriodLineItemViewSort
    dataFileSummaryInfo: DataFileSummaryInfoSort
    numberOfFiles: SortOption
  }
  
  input SubmissionPeriodLineItemViewSort {
    salesLineItemCount: SortOption
    invLineItemCount: SortOption
    earliestFileSubmissionDate: SortOption
  }

  input DataFileSummaryInfoSort{
    numberOfPOSLines: SortOption
    numberOfInventoryLines: SortOption
    submissionPeriodSid: SortOption
    dataFileSid: SortOption
    receivedDate: SortOption
    fileCreateDate: SortOption
  }

  input SubmissionScheduleSort {
    sid: SortOption
    createDate: SortOption
    updateDate: SortOption
    customerSid: SortOption
    dataType: DataTypeSort
    reportingPartner: PartnerSort
    periodRule: SortOption
    name: SortOption
    startDate: SortOption
    endDate: SortOption
    expectedDay: SortOption
    workingDays: SortOption
    isInPeriodReporter: SortOption
    weekOfMonth: SortOption
    monthOfQuarter: SortOption
  }

  input DataTypeSort {
    sid: SortOption
    createDate: SortOption
    updateDate: SortOption
    type: SortOption
  }

  input SubmissionScheduleNotificationSort {
    sid: SortOption
    createDate: SortOption
    updateDate: SortOption
    notificationType: SortOption
    serviceUser: ServiceUserSort
  }

  input NoDataInput {
    sid: ID!
    noDataReason: String
  }
`;
import { Entity, Column, JoinColumn, OneToOne, VirtualColumn, OneToMany } from 'typeorm';
import { CustomerDomainEntity } from '../base/CustomerDomainEntity';
import {
  returnsSubmissionPeriodLineItemView,
  SubmissionPeriodLineItemView
} from './SubmissionPeriodLineItemView';
import {
  reportedFlagSql,
  statusSql,
  filesCountSql
} from './SubmissionPeriodSql';
import {
  returnsSubmissionSchedule,
  SubmissionSchedule
} from './SubmissionSchedule';
import { ServiceUser, returnsServiceUser } from '../user/ServiceUser';
import { DataFileSummaryInfo } from '../datafile/DataFileSummaryInfo';

export const returnsDataFileSummaryInfo = () => DataFileSummaryInfo;

export const dataFileSummaryInfoInverseSide = (dataFileSummaryInfo) =>
  dataFileSummaryInfo.submissionPeriod;

export const returnsSubmissionPeriod = () => SubmissionPeriod;

@Entity({ name: 'SUBMISSION_PERIOD' })
export class SubmissionPeriod extends CustomerDomainEntity {
  @Column({ name: 'EXPECTED_DATE' })
  expectedDate: Date;

  @Column({ name: 'PERIOD_START_DATE' })
  periodStartDate: Date;

  @Column({ name: 'PERIOD_END_DATE' })
  periodEndDate: Date;

  @Column({ name: 'SUBMISSION_SCHEDULE_SID', select: false })
  submissionScheduleSid: number;

  @Column({ name: 'ON_TIME_OVERRIDE' })
  onTimeOverride: boolean;

  @Column({ name: 'NO_DATA' })
  noData: boolean;

  @Column({ name: 'NO_DATA_REASON' })
  noDataReason: string;

  @Column({ name: 'NO_DATA_CREATE_DATE' })
  noDataCreateDate: Date;

  @Column({ name: 'NO_DATA_SERVICE_USER_SID', select: false })
  noDataServiceUserSid: number;

  @OneToOne(returnsServiceUser)
  @JoinColumn({ name: 'NO_DATA_SERVICE_USER_SID' })
  noDataServiceUser: Promise<ServiceUser>;

  @Column({ name: 'TRACKING_LEVEL' })
  trackingLevel: string;

  @Column({ name: 'EXPECTED_DAY' })
  expectedDay: number;

  @Column({ name: 'WORKING_DAYS' })
  workingDays: string;

  @Column({ name: 'IS_IN_PERIOD_REPORTER' })
  isInPeriodReporter: number;

  @Column({ name: 'DELETED' })
  deleted: boolean;

  @OneToOne(returnsSubmissionSchedule)
  @JoinColumn({ name: 'SUBMISSION_SCHEDULE_SID' })
  submissionSchedule?: Promise<SubmissionSchedule>;

  @VirtualColumn({ query: statusSql })
  status?: string;

  @VirtualColumn({ query: reportedFlagSql })
  reportedFlag: boolean;

  @VirtualColumn( {query : filesCountSql} )
  numberOfFiles?: number;

  @OneToMany(returnsDataFileSummaryInfo,dataFileSummaryInfoInverseSide)
  @JoinColumn({ name: 'SID', referencedColumnName: 'submissionPeriodSid' })
  dataFileSummaryInfo?: Promise<DataFileSummaryInfo[]>;

  @OneToOne(returnsSubmissionPeriodLineItemView)
  @JoinColumn({ name: 'SID', referencedColumnName: 'submissionPeriodSid' })
  submissionPeriodLineItemView?: Promise<SubmissionPeriodLineItemView>;

}
export const getDataFileIdSql = (alias: string) => {
    return `SELECT df.id FROM DATA_FILE df WHERE df.SID = ${alias}.DATA_FILE_SID`;
};

export const getDataFileNameSql = (alias: string) => {
    return `SELECT df.file_name FROM DATA_FILE df WHERE df.SID = ${alias}.DATA_FILE_SID`;
};
import { Inject, Service } from 'typedi';
import { DomainEntityService } from '../base/DomainEntityService';
import { DataFileSummaryInfo } from './DataFileSummaryInfo';
import { CustomerService } from '../customer/CustomerService';
import { SubmissionPeriodService } from '../submission/SubmissionPeriodService';

@Service()
export class DataFileSummaryInfoService extends DomainEntityService<DataFileSummaryInfo> {
  @Inject()
  protected customerService: CustomerService;

  @Inject()
  protected submissionPeriodService: SubmissionPeriodService;

  constructor() {
    super(DataFileSummaryInfo);
  }

  getServiceName() {
    return 'DataFileSummaryInfo';
  }

  async createDataFileSummaryInfo(
    custId: string,
    submissionPeriodSid: number,
    dataFileSid: number,
    numberOfPOSLines: number,
    numberOfInventoryLines: number
  ) {
    const cust = await this.customerService.findOneById(custId);

    await this.create({
      customerSid: cust.sid,
      submissionPeriodSid: submissionPeriodSid,
      dataFileSid: dataFileSid,
      numberOfPOSLines: numberOfPOSLines,
      numberOfInventoryLines: numberOfInventoryLines,
    });
}
}
import { Entity, Column, ManyToOne, JoinColumn, VirtualColumn} from 'typeorm';
import { CustomerDomainEntity } from '../base/CustomerDomainEntity';
import { SubmissionPeriod } from '../submission/SubmissionPeriod';
import { getDataFileIdSql, getDataFileNameSql } from './DataFileSummaryInfoSql';

export const returnsSubmissionPeriods = () => SubmissionPeriod;
export const returnsSummaryInfo = (submissionPeriod) => submissionPeriod.dataFileSummaryInfo;

@Entity({ name: 'DATA_FILE_SUMMARY_INFO' })
export class DataFileSummaryInfo extends CustomerDomainEntity {

    @ManyToOne(returnsSubmissionPeriods,returnsSummaryInfo)
    @JoinColumn({ name: 'SUBMISSION_PERIOD_SID', referencedColumnName:'sid'})
    submissionPeriod: SubmissionPeriod;

    @Column({name:'DATA_FILE_SID'})
    dataFileSid: number;

    @Column({name: 'CUSTOMER_SID'})
    customerSid: number;

    @Column({name:'NUM_SLIS'})
    numberOfPOSLines: number;

    @Column({name:'NUM_ILIS'})
    numberOfInventoryLines: number;

    @Column({name: 'CREATE_DATE'})
    receivedDate: Date;
    
    @Column({ name: 'SUBMISSION_PERIOD_SID', nullable: true })
    submissionPeriodSid: number;

    @VirtualColumn({ query: getDataFileIdSql})
    dataFileId?: string;
    
    @VirtualColumn({ query: getDataFileNameSql})
    dataFileName?: string;
}

import { Customer } from './customer/Customer';
import { Partner } from './partner/Partner';
import { Product } from './product/Product';
import { DynamicAttrs } from './attribute/DynamicAttrs';
import { DynamicAttrMetadata } from './attribute/DynamicAttrMetadata';
import { Sales } from './sales/Sales';
import { Address } from './address/Address';
import { Currency } from './base/Currency';
import { DataFile } from './datafile/DataFile';
import { Country } from './address/Country';
import { SalesMatchInfo } from './sales/SalesMatchInfo';
import { ProductAggr } from './product/ProductAggr';
import { GsNumber } from './partner/GsNumber';
import { Inventory } from './inventory/Inventory';
import { SubmissionPeriod } from './submission/SubmissionPeriod';
import { InventoryQuantity } from './inventory/InventoryQuantity';
import { QuantityType } from './inventory/QuantityType';
import { InventoryPrice } from './inventory/InventoryPrice';
import { UserEvent } from './event/UserEvent';
import { UserSession } from './event/UserSession';
import { DataFileState } from './datafile/DataFileState';
import { ParserAttempt } from './datafile/ParserAttempt';
import { PartnerOverlayView } from './partner/PartnerOverlayView';
import { DataState } from './base/DataState';
import { SubmissionSchedule } from './submission/SubmissionSchedule';
import { DataType } from './base/DataType';
import { SubmissionPeriodLineItemView } from './submission/SubmissionPeriodLineItemView';
import { SubmissionScheduleNotification } from './submission/SubmissionScheduleNotification';
import { ServiceUser } from './user/ServiceUser';
import { AuditEvent } from './event/AuditEvent';
import { SubmissionScheduleAudit } from './submission/SubmissionScheduleAudit';
import { AuditType } from './event/AuditType';
import { DataFileSummaryInfo } from './datafile/DataFileSummaryInfo';
import { SubmissionPeriodInfoView } from './submission/SubmissionPeriodInfoView';

export const entities = [
  Customer,
  GsNumber,
  Partner,
  Product,
  ProductAggr,
  Sales,
  Inventory,
  SubmissionPeriod,
  SubmissionSchedule,
  SubmissionScheduleNotification,
  DataType,
  SubmissionPeriodLineItemView,
  InventoryQuantity,
  QuantityType,
  InventoryPrice,
  SalesMatchInfo,
  Address,
  Country,
  Currency,
  DataFile,
  DataFileState,
  DataState,
  ParserAttempt,
  PartnerOverlayView,
  DynamicAttrs,
  DynamicAttrMetadata,
  UserEvent,
  UserSession,
  ServiceUser,
  AuditEvent,
  SubmissionScheduleAudit,
  AuditType,
  DataFileSummaryInfo
];
/* Import Google font - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background: #E3F2FD;
}

/* Chatbot toggler button */
.chatbot-toggler {
  position: fixed;
  bottom: 30px;
  right: 35px;
  outline: none;
  border: none;
  height: 50px;
  width: 50px;
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #724ae8;
  transition: all 0.2s ease;
}

body.show-chatbot .chatbot-toggler {
  transform: rotate(90deg);
}

.chatbot-toggler span {
  color: #fff;
  position: absolute;
}

.chatbot-toggler span:last-child,
body.show-chatbot .chatbot-toggler span:first-child  {
  opacity: 0;
}

body.show-chatbot .chatbot-toggler span:last-child {
  opacity: 1;
}

/* Chatbot container */
.chatbot {
  position: fixed;
  right: 35px;
  bottom: 90px;
  width: 420px;
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
  transform-origin: bottom right;
  box-shadow: 0 0 128px 0 rgba(0,0,0,0.1),
              0 32px 64px -48px rgba(0,0,0,0.5);
  transition: all 0.1s ease;
}

body.show-chatbot .chatbot {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Chatbot header */
.chatbot header {
  padding: 16px 0;
  position: relative;
  text-align: center;
  color: #fff;
  background: #724ae8;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h2 {
  font-size: 1.4rem;
}

.chatbot header span {
  position: absolute;
  right: 15px;
  top: 50%;
  display: none;
  cursor: pointer;
  transform: translateY(-50%);
}

/* Chatbox styles */
.chatbot .chatbox {
  overflow-y: auto;
  height: 510px;
  padding: 30px 20px 100px;
}

/* Scrollbar styles */
.chatbot :where(.chatbox, textarea)::-webkit-scrollbar {
  width: 6px;
}

.chatbot :where(.chatbox, textarea)::-webkit-scrollbar-track {
  background: #fff;
  border-radius: 25px;
}

.chatbot :where(.chatbox, textarea)::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 25px;
}

/* Chat message styles */
.chatbox .chat {
  display: flex;
  list-style: none;
}

.chatbox .outgoing {
  margin: 20px 0;
  justify-content: flex-end;
}

.chatbox .incoming span {
  width: 32px;
  height: 32px;
  color: #fff;
  cursor: default;
  text-align: center;
  line-height: 32px;
  align-self: flex-end;
  background: #724ae8;
  border-radius: 4px;
  margin: 0 10px 7px 0;
}

.chatbox .chat p {
  white-space: pre-wrap;
  padding: 12px 16px;
  border-radius: 10px 10px 0 10px;
  max-width: 75%;
  color: #fff;
  font-size: 0.95rem;
  background: #724ae8;
}

.chatbox .incoming p {
  border-radius: 10px 10px 10px 0;
}

.chatbox .chat p.error {
  color: #721c24;
  background: #f8d7da;
}

.chatbox .incoming p {
  color: #000;
  background: #f2f2f2;
}

/* Chat input styles */
.chatbot .chat-input {
  display: flex;
  gap: 5px;
  position: absolute;
  bottom: 0;
  width: 100%;
  background: #fff;
  padding: 3px 20px;
  border-top: 1px solid #ddd;
}

.chat-input textarea {
  height: 55px;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  max-height: 180px;
  padding: 15px 15px 15px 0;
  font-size: 0.95rem;
}

.chat-input span {
  align-self: flex-end;
  color: #724ae8;
  cursor: pointer;
  height: 55px;
  display: flex;
  align-items: center;
  visibility: hidden;
  font-size: 1.35rem;
}

.chat-input textarea:valid ~ span {
  visibility: visible;
}

/* Responsive styles for smaller screens */
@media (max-width: 490px) {
  .chatbot-toggler {
    right: 20px;
    bottom: 20px;
  }

  .chatbot {
    right: 0;
    bottom: 0;
    height: 100%;
    border-radius: 0;
    width: 100%;
  }

  .chatbot .chatbox {
    height: 90%;
    padding: 25px 15px 100px;
  }

  .chatbot .chat-input {
    padding: 5px 15px;
  }

  .chatbot header span {
    display: block;
  }
}
const chatbotToggler = document.querySelector(".chatbot-toggler");
const closeBtn = document.querySelector(".close-btn");
const chatbox = document.querySelector(".chatbox");
const chatInput = document.querySelector(".chat-input textarea");
const sendChatBtn = document.querySelector(".chat-input span");

let userMessage = null; // Variable to store user's message
const API_KEY = "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"; // Paste your API key here
const inputInitHeight = chatInput.scrollHeight;

const createChatLi = (message, className) => {
    // Create a chat <li> element with passed message and className
    const chatLi = document.createElement("li");
    chatLi.classList.add("chat", `${className}`);
    let chatContent = className === "outgoing" ? `<p></p>` : `<span class="material-symbols-outlined">smart_toy</span><p></p>`;
    chatLi.innerHTML = chatContent;
    chatLi.querySelector("p").textContent = message;
    return chatLi; // return chat <li> element
}

const generateResponse = (chatElement) => {
    const API_URL = "https://api.openai.com/v1/chat/completions";
    const messageElement = chatElement.querySelector("p");

    // Define the properties and message for the API request
    const requestOptions = {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
            "Authorization": `Bearer ${API_KEY}`
        },
        body: JSON.stringify({
            model: "gpt-3.5-turbo",
            messages: [{role: "user", content: userMessage}],
        })
    }

    // Send POST request to API, get response and set the reponse as paragraph text
    fetch(API_URL, requestOptions).then(res => res.json()).then(data => {
        messageElement.textContent = data.choices[0].message.content.trim();
    }).catch(() => {
        messageElement.classList.add("error");
        messageElement.textContent = "Oops! Something went wrong. Please try again.";
    }).finally(() => chatbox.scrollTo(0, chatbox.scrollHeight));
}

const handleChat = () => {
    userMessage = chatInput.value.trim(); // Get user entered message and remove extra whitespace
    if(!userMessage) return;

    // Clear the input textarea and set its height to default
    chatInput.value = "";
    chatInput.style.height = `${inputInitHeight}px`;

    // Append the user's message to the chatbox
    chatbox.appendChild(createChatLi(userMessage, "outgoing"));
    chatbox.scrollTo(0, chatbox.scrollHeight);
    
    setTimeout(() => {
        // Display "Thinking..." message while waiting for the response
        const incomingChatLi = createChatLi("Thinking...", "incoming");
        chatbox.appendChild(incomingChatLi);
        chatbox.scrollTo(0, chatbox.scrollHeight);
        generateResponse(incomingChatLi);
    }, 600);
}

chatInput.addEventListener("input", () => {
    // Adjust the height of the input textarea based on its content
    chatInput.style.height = `${inputInitHeight}px`;
    chatInput.style.height = `${chatInput.scrollHeight}px`;
});

chatInput.addEventListener("keydown", (e) => {
    // If Enter key is pressed without Shift key and the window 
    // width is greater than 800px, handle the chat
    if(e.key === "Enter" && !e.shiftKey && window.innerWidth > 800) {
        e.preventDefault();
        handleChat();
    }
});

sendChatBtn.addEventListener("click", handleChat);
closeBtn.addEventListener("click", () => document.body.classList.remove("show-chatbot"));
chatbotToggler.addEventListener("click", () => document.body.classList.toggle("show-chatbot"));
export const SubmissionDef = `
  type Query {
    submissionPeriods(
      offset: Float, 
      limit: Float,
      filters: SubmissionPeriodFilters,
      sort: SubmissionPeriodSort
    ): [SubmissionPeriod]
    submissionSchedules(
      offset: Float, 
      limit: Float,
      filters: SubmissionScheduleFilters, 
      sort: SubmissionScheduleSort
    ): [SubmissionSchedule]
    submissionScheduleNotifications(
      submissionScheduleSid: ID,
      offset: Float,
      limit: Float,
      filters: SubmissionScheduleNotificationFilters,
      sort: SubmissionScheduleNotificationSort
    ): [SubmissionScheduleNotification]
  }

  type Mutation {
    markNoData(data: [NoDataInput]): [MutationResponse] @auth(object: SubmissionPeriod)
  }

  type SubmissionPeriod {
    sid: ID
    createDate: Date
    updateDate: Date
    customerSid: ID
    expectedDate: Date
    periodStartDate: Date
    periodEndDate: Date
    noData: Boolean
    noDataReason: String
    noDataCreateDate: Date
    onTimeOverride: Boolean
    expectedDay: String
    workingDays: String
    isInPeriodReporter: Float
    trackingLevel: String
    submissionSchedule: SubmissionSchedule
    status: String
    reportedFlag: Boolean
    numberOfFiles: Float
    dataFileSummaryInfo: [DataFileSummaryInfo]
    submissionPeriodInfoView: SubmissionPeriodInfoView
    submissionPeriodLineItemView: SubmissionPeriodLineItemView
    noDataServiceUser: ServiceUser
  }

  type SubmissionPeriodLineItemView {
    salesLineItemCount: Float
    invLineItemCount: Float
    earliestFileSubmissionDate: Date
  }

  type SubmissionPeriodInfoView {
    numberOfInventoryLines: Float
    numberOfPOSLines:Float
    fileName: String
    fileId: Float
  }

  type DataFileSummaryInfo{
    numberOfPOSLines: Float
    numberOfInventoryLines: Float
    submissionPeriodSid: Float
    dataFileSid: Float
    receivedDate: Date
    fileCreateDate: Date
    dataFileId: String
    dataFileName: String
  }
  
  type SubmissionSchedule {
    sid: ID
    createDate: Date
    updateDate: Date
    customerSid: ID
    dataType: DataType    
    reportingPartner: Partner
    periodRule: String
    name: String
    startDate: Date
    endDate: Date
    expectedDay: String
    workingDays: String
    isInPeriodReporter: Boolean
    weekOfMonth: Float
    monthOfQuarter: Float
  }

  type DataType {
    sid: ID
    createDate: Date
    updateDate: Date
    type: String
  }

  type SubmissionScheduleNotification {
    sid: ID
    createDate: Date
    updateDate: Date
    customerSid: ID
    submissionScheduleSid: ID
    notificationType: NotificationType
    serviceUser: ServiceUser
  }

  enum NotificationType {
    PARSE_SUCCESS
    LATE
    PARSE_FAIL
    EXPECTED
  }

  input SubmissionPeriodFilters {
    sid: IDFilter
    createDate: DateFilter
    updateDate: DateFilter
    customerSid: IDFilter
    expectedDate: DateFilter
    periodStartDate: DateFilter
    periodEndDate: DateFilter
    noDataCreateDate: DateFilter
    submissionSchedule: SubmissionScheduleFilters
    status: StringFilter
    reportedFlag: BooleanFilter
    submissionPeriodLineItemView: SubmissionPeriodLineItemViewFilter
    dataFileSummaryInfo: DataFileSummaryInfoFilter
    numberOfFiles: NumberFilter
  }
  
  input SubmissionPeriodLineItemViewFilter {
    salesLineItemCount: NumberFilter
    invLineItemCount: NumberFilter
    earliestFileSubmissionDate: DateFilter
  }

  input DataFileSummaryInfoFilter{
    numberOfPOSLines: NumberFilter
    numberOfInventoryLines: NumberFilter
    submissionPeriodSid: NumberFilter
    dataFileSid: NumberFilter
    receivedDate: DateFilter
    fileCreateDate: DateFilter
  }

  input SubmissionScheduleFilters {
    sid: IDFilter
    createDate: DateFilter
    updateDate: DateFilter
    customerSid: IDFilter
    reportingPartner: PartnerFilter
    name: StringFilter
    dataType: DataTypeFilter
    periodRule: StringFilter
    expectedDay: StringFilter
    workingDays: StringFilter
    startDate: DateFilter
    endDate: DateFilter
    isInPeriodReporter: BooleanFilter
    weekOfMonth: NumberFilter
    monthOfQuarter: NumberFilter
  }

  input DataTypeFilter {
    sid: IDFilter
    createDate: DateFilter
    updateDate: DateFilter
    type: StringFilter
  }

  input SubmissionScheduleNotificationFilters {
    sid: IDFilter
    createDate: DateFilter
    updateDate: DateFilter
    customerSid: IDFilter
    submissionScheduleSid: IDFilter
    notificationType: StringFilter
    serviceUser: ServiceUserFilters
  }

  input SubmissionPeriodSort {
    sid: SortOption
    createDate: SortOption
    updateDate: SortOption
    expectedDate: SortOption
    periodStartDate: SortOption
    periodEndDate: SortOption
    noDataCreateDate: SortOption
    submissionSchedule: SubmissionScheduleSort
    status: SortOption
    reportedFlag: SortOption
    submissionPeriodLineItemView: SubmissionPeriodLineItemViewSort
    dataFileSummaryInfo: DataFileSummaryInfoSort
    numberOfFiles: SortOption
  }
  
  input SubmissionPeriodLineItemViewSort {
    salesLineItemCount: SortOption
    invLineItemCount: SortOption
    earliestFileSubmissionDate: SortOption
  }

  input DataFileSummaryInfoSort{
    numberOfPOSLines: SortOption
    numberOfInventoryLines: SortOption
    submissionPeriodSid: SortOption
    dataFileSid: SortOption
    receivedDate: SortOption
    fileCreateDate: SortOption
  }

  input SubmissionScheduleSort {
    sid: SortOption
    createDate: SortOption
    updateDate: SortOption
    customerSid: SortOption
    dataType: DataTypeSort
    reportingPartner: PartnerSort
    periodRule: SortOption
    name: SortOption
    startDate: SortOption
    endDate: SortOption
    expectedDay: SortOption
    workingDays: SortOption
    isInPeriodReporter: SortOption
    weekOfMonth: SortOption
    monthOfQuarter: SortOption
  }

  input DataTypeSort {
    sid: SortOption
    createDate: SortOption
    updateDate: SortOption
    type: SortOption
  }

  input SubmissionScheduleNotificationSort {
    sid: SortOption
    createDate: SortOption
    updateDate: SortOption
    notificationType: SortOption
    serviceUser: ServiceUserSort
  }

  input NoDataInput {
    sid: ID!
    noDataReason: String
  }
`;
import { Entity, Column, JoinColumn, OneToOne, VirtualColumn, OneToMany, ManyToMany, ManyToOne } from 'typeorm';
import { CustomerDomainEntity } from '../base/CustomerDomainEntity';
import {
  returnsSubmissionPeriodLineItemView,
  SubmissionPeriodLineItemView
} from './SubmissionPeriodLineItemView';
import {
  reportedFlagSql,
  statusSql,
  fileIdsSql,
  filesCountSql,
  filesDataSql
} from './SubmissionPeriodSql';
import {
  returnsSubmissionSchedule,
  SubmissionSchedule
} from './SubmissionSchedule';
import { ServiceUser, returnsServiceUser } from '../user/ServiceUser';
import { DataFileSummaryInfo, returnsSummaryInfo } from '../datafile/DataFileSummaryInfo';
import { SubmissionPeriodInfoView } from './SubmissionPeriodInfoView';

export const returnsDataFileSummaryInfo = () => DataFileSummaryInfo;

export const dataFileSummaryInfoInverseSide = (dataFileSummaryInfo) =>
  dataFileSummaryInfo.submissionPeriod;

export const returnsSubmissionPeriod = () => SubmissionPeriod;

@Entity({ name: 'SUBMISSION_PERIOD' })
export class SubmissionPeriod extends CustomerDomainEntity {
  @Column({ name: 'EXPECTED_DATE' })
  expectedDate: Date;

  @Column({ name: 'PERIOD_START_DATE' })
  periodStartDate: Date;

  @Column({ name: 'PERIOD_END_DATE' })
  periodEndDate: Date;

  @Column({ name: 'SUBMISSION_SCHEDULE_SID', select: false })
  submissionScheduleSid: number;

  @Column({ name: 'ON_TIME_OVERRIDE' })
  onTimeOverride: boolean;

  @Column({ name: 'NO_DATA' })
  noData: boolean;

  @Column({ name: 'NO_DATA_REASON' })
  noDataReason: string;

  @Column({ name: 'NO_DATA_CREATE_DATE' })
  noDataCreateDate: Date;

  @Column({ name: 'NO_DATA_SERVICE_USER_SID', select: false })
  noDataServiceUserSid: number;

  @OneToOne(returnsServiceUser)
  @JoinColumn({ name: 'NO_DATA_SERVICE_USER_SID' })
  noDataServiceUser: Promise<ServiceUser>;

  @Column({ name: 'TRACKING_LEVEL' })
  trackingLevel: string;

  @Column({ name: 'EXPECTED_DAY' })
  expectedDay: number;

  @Column({ name: 'WORKING_DAYS' })
  workingDays: string;

  @Column({ name: 'IS_IN_PERIOD_REPORTER' })
  isInPeriodReporter: number;

  @Column({ name: 'DELETED' })
  deleted: boolean;

  @OneToOne(returnsSubmissionSchedule)
  @JoinColumn({ name: 'SUBMISSION_SCHEDULE_SID' })
  submissionSchedule?: Promise<SubmissionSchedule>;

  @VirtualColumn({ query: statusSql })
  status?: string;

  @VirtualColumn({ query: reportedFlagSql })
  reportedFlag: boolean;

  // @VirtualColumn( {query : fileIdsSql} )
  // fileIds?: string;

  // firstFileId?: string;

  // firstFileName?: string;

  // firstFileCreateDate?: Date;

  @VirtualColumn( {query : filesCountSql} )
  numberOfFiles?: number;

  @OneToOne(returnsDataFileSummaryInfo)
  @JoinColumn({ name: 'SID', referencedColumnName: 'submissionPeriodSid' })
  submissionPeriodInfoView?: Promise<SubmissionPeriodInfoView>;

  @OneToMany(returnsDataFileSummaryInfo,dataFileSummaryInfoInverseSide)
  @JoinColumn({ name: 'SID', referencedColumnName: 'submissionPeriodSid' })
  dataFileSummaryInfo?: Promise<DataFileSummaryInfo[]>;

  // this is the aggregation that matches the reporting partner
  // dataFileSummaryInfo: DataFileSummaryInfo;

  @OneToOne(returnsSubmissionPeriodLineItemView)
  @JoinColumn({ name: 'SID', referencedColumnName: 'submissionPeriodSid' })
  submissionPeriodLineItemView?: Promise<SubmissionPeriodLineItemView>;

}
import { Entity, Column, ManyToOne, JoinColumn, OneToMany, VirtualColumn} from 'typeorm';
import { CustomerDomainEntity } from '../base/CustomerDomainEntity';
import { returnsSubmissionPeriod } from '../submission/SubmissionPeriod';
import { SubmissionPeriod } from '../submission/SubmissionPeriod';
import {getDataFileIdSql, getDataFileNameSql} from './DataFileSummaryInfoSql';

export const returnsSubmissionPeriods = () => SubmissionPeriod;
export const returnsSummaryInfo = (submissionPeriod) => submissionPeriod.dataFileSummaryInfo;

@Entity({ name: 'DATA_FILE_SUMMARY_INFO' })
export class DataFileSummaryInfo extends CustomerDomainEntity {

    @ManyToOne(returnsSubmissionPeriods,returnsSummaryInfo)
    @JoinColumn({ name: 'SUBMISSION_PERIOD_SID', referencedColumnName:'sid'})
    submissionPeriod: SubmissionPeriod;

    // @ManyToOne(returnsUserSession)
    // @JoinColumn({ name: 'USER_SESSION_SID' })
    // userSession?: Promise<UserSession>;

    @Column({name:'DATA_FILE_SID'})
    dataFileSid: number;

    @Column({name: 'CUSTOMER_SID'})
    customerSid: number;

    @Column({name:'NUM_SLIS'})
    numberOfPOSLines: number;

    @Column({name:'NUM_ILIS'})
    numberOfInventoryLines: number;

    @Column({name: 'CREATE_DATE'})
    receivedDate: Date;
    
    // specifying that submissionPeriodSid can be null
    @Column({ name: 'SUBMISSION_PERIOD_SID', nullable: true })
    submissionPeriodSid: number;

    // VirtualColumn to get DataFile information
    @VirtualColumn({ query: getDataFileIdSql})
    dataFileId?: string;

    // VirtualColumn to get DataFile information
    @VirtualColumn({ query: getDataFileNameSql})
    dataFileName?: string;

    // @VirtualColumn( {query : fileIdSql} )
    // fileId?: number[];

    // @VirtualColumn( {query : filesCountSql} )
    // numberOfFiles?: number;
}

function prefix_add_footer_styles() {
	wp_enqueue_style( 'child-main-styles', get_stylesheet_directory_uri() . '/style.css' , '', '');
};
add_action( 'get_footer', 'prefix_add_footer_styles' );
I wonder why people choose on-demand applications over traditional business models. With the fact that the market value of the On Demand Services app is predicted to expand by $335 Billion by 2025. It is secure enough to say that the economy of on-demand is drastically enlarging at a rapid pace. 

Here let’s see the popular industries that leverage the On-demand applications.

Food Delivery
E-commerce & Retail
Transportation

When it comes to developing an on-demand application for your business, Maticz provides you the cutting-edge solutions with their On-demand app development. Their team of proficient developers and designers is equipped with the knowledge and talents that are required to develop an innovative and user-friendly app that will assist you in reaching your desired goals. By hiring on-demand app developers in India you can develop an application that provides convenience, saves your precious time, is cost-effective, offers more opportunities, is eco-friendly, and is user-friendly. 
import { Entity, Column, JoinColumn, OneToOne, VirtualColumn, OneToMany, ManyToMany, ManyToOne } from 'typeorm';
import { CustomerDomainEntity } from '../base/CustomerDomainEntity';
import {
  returnsSubmissionPeriodLineItemView,
  SubmissionPeriodLineItemView
} from './SubmissionPeriodLineItemView';
import {
  reportedFlagSql,
  statusSql,
  fileIdsSql,
  filesCountSql,
  filesDataSql
} from './SubmissionPeriodSql';
import {
  returnsSubmissionSchedule,
  SubmissionSchedule
} from './SubmissionSchedule';
import { ServiceUser, returnsServiceUser } from '../user/ServiceUser';
import { DataFileSummaryInfo, returnsSummaryInfo } from '../datafile/DataFileSummaryInfo';
import { SubmissionPeriodInfoView } from './SubmissionPeriodInfoView';

export const returnsDataFileSummaryInfo = () => DataFileSummaryInfo;

export const dataFileSummaryInfoInverseSide = (dataFileSummaryInfo) =>
  dataFileSummaryInfo.submissionPeriod;

export const returnsSubmissionPeriod = () => SubmissionPeriod;

@Entity({ name: 'SUBMISSION_PERIOD' })
export class SubmissionPeriod extends CustomerDomainEntity {
  @Column({ name: 'EXPECTED_DATE' })
  expectedDate: Date;

  @Column({ name: 'PERIOD_START_DATE' })
  periodStartDate: Date;

  @Column({ name: 'PERIOD_END_DATE' })
  periodEndDate: Date;

  @Column({ name: 'SUBMISSION_SCHEDULE_SID', select: false })
  submissionScheduleSid: number;

  @Column({ name: 'ON_TIME_OVERRIDE' })
  onTimeOverride: boolean;

  @Column({ name: 'NO_DATA' })
  noData: boolean;

  @Column({ name: 'NO_DATA_REASON' })
  noDataReason: string;

  @Column({ name: 'NO_DATA_CREATE_DATE' })
  noDataCreateDate: Date;

  @Column({ name: 'NO_DATA_SERVICE_USER_SID', select: false })
  noDataServiceUserSid: number;

  @OneToOne(returnsServiceUser)
  @JoinColumn({ name: 'NO_DATA_SERVICE_USER_SID' })
  noDataServiceUser: Promise<ServiceUser>;

  @Column({ name: 'TRACKING_LEVEL' })
  trackingLevel: string;

  @Column({ name: 'EXPECTED_DAY' })
  expectedDay: number;

  @Column({ name: 'WORKING_DAYS' })
  workingDays: string;

  @Column({ name: 'IS_IN_PERIOD_REPORTER' })
  isInPeriodReporter: number;

  @Column({ name: 'DELETED' })
  deleted: boolean;

  @OneToOne(returnsSubmissionSchedule)
  @JoinColumn({ name: 'SUBMISSION_SCHEDULE_SID' })
  submissionSchedule?: Promise<SubmissionSchedule>;

  @VirtualColumn({ query: statusSql })
  status?: string;

  @VirtualColumn({ query: reportedFlagSql })
  reportedFlag: boolean;

  // @VirtualColumn( {query : fileIdsSql} )
  // fileIds?: string;

  // firstFileId?: string;

  // firstFileName?: string;

  // firstFileCreateDate?: Date;

  @VirtualColumn( {query : filesCountSql} )
  numberOfFiles?: number;

  @OneToOne(returnsDataFileSummaryInfo)
  @JoinColumn({ name: 'SID', referencedColumnName: 'submissionPeriodSid' })
  submissionPeriodInfoView?: Promise<SubmissionPeriodInfoView>;

  @OneToMany(returnsDataFileSummaryInfo,dataFileSummaryInfoInverseSide)
  @JoinColumn({ name: 'SID', referencedColumnName: 'submissionPeriodSid' })
  dataFileSummaryInfo: Promise<DataFileSummaryInfo[]>;

  // this is the aggregation that matches the reporting partner
  // dataFileSummaryInfo: DataFileSummaryInfo;

  @OneToOne(returnsSubmissionPeriodLineItemView)
  @JoinColumn({ name: 'SID', referencedColumnName: 'submissionPeriodSid' })
  submissionPeriodLineItemView?: Promise<SubmissionPeriodLineItemView>;

}
import { Entity, Column, ManyToOne, JoinColumn, OneToMany, VirtualColumn} from 'typeorm';
import { CustomerDomainEntity } from '../base/CustomerDomainEntity';
import { returnsSubmissionPeriod } from '../submission/SubmissionPeriod';
import { SubmissionPeriod } from '../submission/SubmissionPeriod';
import {getDataFileIdSql, getDataFileNameSql} from './DataFileSummaryInfoSql';

export const returnsSubmissionPeriods = () => SubmissionPeriod;
export const returnsSummaryInfo = (submissionPeriod) => submissionPeriod.dataFileSummaryInfo;

@Entity({ name: 'DATA_FILE_SUMMARY_INFO' })
export class DataFileSummaryInfo extends CustomerDomainEntity {

    @ManyToOne(returnsSubmissionPeriods,returnsSummaryInfo)
    @JoinColumn({ name: 'SUBMISSION_PERIOD_SID', referencedColumnName:'sid'})
    submissionPeriod: SubmissionPeriod;

    // @ManyToOne(returnsUserSession)
    // @JoinColumn({ name: 'USER_SESSION_SID' })
    // userSession?: Promise<UserSession>;

    @Column({name:'DATA_FILE_SID'})
    dataFileSid: number;

    @Column({name: 'CUSTOMER_SID'})
    customerSid: number;

    @Column({name:'NUM_SLIS'})
    numberOfPOSLines: number;

    @Column({name:'NUM_ILIS'})
    numberOfInventoryLines: number;

    @Column({name: 'CREATE_DATE'})
    receivedDate: Date;
    
    // specifying that submissionPeriodSid can be null
    @Column({ name: 'SUBMISSION_PERIOD_SID', nullable: true })
    submissionPeriodSid: number;

    // VirtualColumn to get DataFile information
    @VirtualColumn({ query: getDataFileIdSql})
    dataFileId?: string;

    // VirtualColumn to get DataFile information
    @VirtualColumn({ query: getDataFileNameSql})
    dataFileName?: string;

    // @VirtualColumn( {query : fileIdSql} )
    // fileId?: number[];

    // @VirtualColumn( {query : filesCountSql} )
    // numberOfFiles?: number;
}

from fastapi import FastAPI, HTTPException, Security, status
from fastapi.security import APIKeyHeader


api_keys = [
    "my_api_key"
]

app = FastAPI()

api_key_header = APIKeyHeader(name="X-API-Key")

def get_api_key(api_key_header: str = Security(api_key_header)) -> str:
    if api_key_header in api_keys:
        return api_key_header
    raise HTTPException(
        status_code=status.HTTP_401_UNAUTHORIZED,
        detail="Invalid or missing API Key",
    )

@app.get("/protected")
def protected_route(api_key: str = Security(get_api_key)):
    # Process the request for authenticated users
    return {"message": "Access granted!"}

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)


wget https://blah/blah/stats --header="X-API-Key: key1"
from fastapi import FastAPI
from fastapi.responses import StreamingResponse
import io
import pandas as pd

app = FastAPI()

@app.get("/get_csv")
async def get_csv():
    df = pd.DataFrame(dict(col1 = 1, col2 = 2), index=[0])
    stream = io.StringIO()
    df.to_csv(stream, index = False)
    response = StreamingResponse(iter([stream.getvalue()]),
                                 media_type="text/csv"
                                )
    response.headers["Content-Disposition"] = "attachment; filename=export.csv"
    return response
star

Sun Dec 24 2023 16:45:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git

@hirsch #bash

star

Sun Dec 24 2023 15:17:13 GMT+0000 (Coordinated Universal Time)

@akilavikum #html #tailwindcss

star

Sun Dec 24 2023 00:28:48 GMT+0000 (Coordinated Universal Time)

@misha@11

star

Sat Dec 23 2023 18:07:33 GMT+0000 (Coordinated Universal Time) https://anvil.works/forum/t/simple-audio-player/3479/3?u

@webdeveloper_

star

Sat Dec 23 2023 17:22:51 GMT+0000 (Coordinated Universal Time) https://anvil.works/forum/t/converting-audio-file-to-text/6625/6

@webdeveloper_

star

Sat Dec 23 2023 16:10:52 GMT+0000 (Coordinated Universal Time) https://github.com/codesFolder/Submissions/tree/master

@coderworld

star

Sat Dec 23 2023 16:08:32 GMT+0000 (Coordinated Universal Time)

@coderworld

star

Sat Dec 23 2023 16:02:58 GMT+0000 (Coordinated Universal Time)

@coderworld

star

Sat Dec 23 2023 15:58:21 GMT+0000 (Coordinated Universal Time)

@coderworld

star

Sat Dec 23 2023 15:40:38 GMT+0000 (Coordinated Universal Time)

@mebean

star

Sat Dec 23 2023 15:29:41 GMT+0000 (Coordinated Universal Time) https://anvil.works/forum/t/converting-audio-file-to-text/6625/6

@webdeveloper_

star

Sat Dec 23 2023 14:33:30 GMT+0000 (Coordinated Universal Time)

@Paloma #vue.js #js

star

Sat Dec 23 2023 13:49:53 GMT+0000 (Coordinated Universal Time)

@mebean #بهار #جو #لد

star

Sat Dec 23 2023 11:05:03 GMT+0000 (Coordinated Universal Time) https://filetransfer.io/data-package/PqVlozHU#link

@Jevin2090

star

Sat Dec 23 2023 11:02:28 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/10.x/installation

@rashed

star

Sat Dec 23 2023 10:27:58 GMT+0000 (Coordinated Universal Time)

@saa_adit

star

Sat Dec 23 2023 10:27:34 GMT+0000 (Coordinated Universal Time)

@saa_adit

star

Sat Dec 23 2023 10:26:52 GMT+0000 (Coordinated Universal Time)

@saa_adit

star

Sat Dec 23 2023 03:01:36 GMT+0000 (Coordinated Universal Time) https://zhuanlan.zhihu.com/p/545762616

@mikeee

star

Sat Dec 23 2023 01:40:13 GMT+0000 (Coordinated Universal Time) https://developer.chrome.com/docs/extensions/reference/manifest/content-scripts

@K #json/5

star

Sat Dec 23 2023 00:05:25 GMT+0000 (Coordinated Universal Time)

@leninzapata #css

star

Fri Dec 22 2023 23:18:44 GMT+0000 (Coordinated Universal Time)

@swina

star

Fri Dec 22 2023 16:50:58 GMT+0000 (Coordinated Universal Time)

@aatish

star

Fri Dec 22 2023 16:38:47 GMT+0000 (Coordinated Universal Time) https://leetcode.com/problems/longest-consecutive-sequence/

@sumanthbijapur

star

Fri Dec 22 2023 16:28:45 GMT+0000 (Coordinated Universal Time)

@darshcode #excel

star

Fri Dec 22 2023 16:01:09 GMT+0000 (Coordinated Universal Time)

@ivxn

star

Fri Dec 22 2023 15:36:19 GMT+0000 (Coordinated Universal Time) https://ru.bongacams26.com/members/purchase-tokens?spd

@fathulla666

star

Fri Dec 22 2023 15:22:59 GMT+0000 (Coordinated Universal Time)

@Fahrine #java

star

Fri Dec 22 2023 15:21:46 GMT+0000 (Coordinated Universal Time)

@Fahrine #java

star

Fri Dec 22 2023 14:00:26 GMT+0000 (Coordinated Universal Time)

@aatish

star

Fri Dec 22 2023 12:04:09 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 12:03:36 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 12:03:02 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 12:02:28 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 12:02:09 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 12:01:51 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 12:01:31 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 12:01:11 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 11:51:05 GMT+0000 (Coordinated Universal Time)

@rajat

star

Fri Dec 22 2023 11:49:55 GMT+0000 (Coordinated Universal Time)

@rajat

star

Fri Dec 22 2023 11:24:18 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 11:23:47 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 11:23:27 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 10:27:50 GMT+0000 (Coordinated Universal Time)

@mubashir_aziz

star

Fri Dec 22 2023 10:10:35 GMT+0000 (Coordinated Universal Time) https://maticz.com/how-to-create-a-crypto-trading-bot

@jamielucas #drupal

star

Fri Dec 22 2023 10:09:39 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 10:09:12 GMT+0000 (Coordinated Universal Time)

@thanuj #sql

star

Fri Dec 22 2023 09:37:50 GMT+0000 (Coordinated Universal Time) https://medium.com/@valerio.uberti23/a-beginners-guide-to-using-api-keys-in-fastapi-and-python-256fe284818d

@quaie #python #fastapi

star

Fri Dec 22 2023 09:11:04 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/61140398/fastapi-return-a-file-response-with-the-output-of-a-sql-query

@quaie #python #fastapi #pandas

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension