{% assign i = 0 %}
{% assign collection_index = 0 %}
{% assign slide_index = 0 %}
{% assign content_index = 0 %}
{% assign product_index = 0 %}
{% assign carousel_index = 0 %}
{% assign content_data_index = 0 %}
{% assign collection_list_index = 0 %}
{% if contents_actual_size > '0' %}
{% for content_type in contents %}
	{% if content_type == "product" %}
		{% for collection_option in collections_options limit:1 offset:collection_index %}
				<section data-section-no={{i}} class="py-section product-section">
					<div class="container">
					<h3 class="section-title">
						{{ collection_names[collection_index] }}
					</h3>
					<div class="section-title-details">Wide range of polymer products available</div>
					<div class="wrapper">
					{% if item_collections[collection_index] %}
					{% assign pages = item_collections[collection_index].size %}
					<div class="products-grid" data-total-image="{{pages}}">
					<ul class="row">
						{% for items in item_collections[collection_index] limit:1 offset:collection_index %}
							{% assign product_rows_content = 1 %}
							{% assign max_product_content = collections_featured_options.products_per_row_num | times : collections_featured_options.rows %}
							{% for item_details in items  %}
								{% if max_product_content >= product_rows_content  %}
						<li class="col-md-3">
							{% if item_details.item_disable_link != true %}
							<a href="{{website.site_url}}products/{{item_details.item_url}}" class="collection-list-item">
							{% else %}
							<a href="{{website.site_url}}" class="collection-list-item">
							{% endif %}
								<div class="product-imgss" style="background-image: url();">
								{% if item_details.item_compare_price > 0 %}
									<span class="badge-discount"></span>
								{% endif %}
									{% if item_details.item_picid != "_large." %}
									<div  class="product-img" style="background-image: url('{{ website.pic_url }}{{ item_details.item_picid }}');"></div>
									{% else %}
									<img src="{{ website.site_url }}/uploads/logo.png"/>
									{% endif %}
								</div>
								<div class="collection-list-info">
									<span class="collection-list-item__name">{{item_details.item_name}}</span>
								</div>
							</a>
						</li>
							{% assign product_rows_content = product_rows_content | plus: 1 %}
							{% endif %}
							{% endfor %}
						{% endfor %}	
					{% endif %}
					</ul>
					<div class="text-center">
          	<a href="{{website.site_url}}collections" class="btn">ดูทั้งหมด</a>
          </div>
					</div>
					</div>
				</div>
				</section> 			
		{% assign collection_index = collection_index | plus: 1 %}
		{% endfor %}
	{% elsif content_type == 'carousel' %}
		<section class="main-slider" data-section-no={{i}} >

			<div class="main-slider-wrapper ">
				<div class="slides">
	{% for carousel_pics in carousel_pic_options  limit:1  offset: slide_index %}
		{% assign carousel_data_option_index = 0 %}
		{% for carousel_pic in carousel_pics %}
		{% assign text_option = carousel_texts[carousel_index] %}
		{% assign mobile_data = carousel_mobile_pics[carousel_index] %}
		{% assign carousel_links = carousel_pic_links[carousel_index] %}
					<div>
						{% if carousel_links[carousel_data_option_index].url != blank %}
						<a href="{{carousel_links[carousel_data_option_index].url}}">
						<div class="slides-item">
							<div class="slides-img"  style="background-image: url('{{ website.theme_pics }}{{carousel_pic}}')"></div>
							<div class="slides-text-wrapper container">
								<h1 class="slides-text {{text_option[carousel_data_option_index].header_color}}">{{text_option[carousel_data_option_index].header}}</h1>
								<h4 class="slides-details {{text_option[carousel_data_option_index].text_color}}">{{text_option[carousel_data_option_index].text}}</h4>
								<!--<button class="slides-btn">Read more</button>-->
							</div>
						</div>
						</a>
						{% else %}
						<div class="slides-item">
							<div class="slides-img"  style="background-image: url('{{ website.theme_pics }}{{carousel_pic}}')"></div>
							<div class="slides-text-wrapper container">
								<h1 class="slides-text {{text_option[carousel_data_option_index].header_color}}">{{text_option[carousel_data_option_index].header}}</h1>
								<h4 class="slides-details {{text_option[carousel_data_option_index].text_color}}">{{text_option[carousel_data_option_index].text}}</h4>
								<!--<button class="slides-btn">Read more</button>-->
							</div>
						</div>
						{% endif %}
					</div>	
					{% assign carousel_data_option_index = carousel_data_option_index | plus: 1 %}
			{% endfor %}
			{% assign carousel_index = carousel_index | plus: 1 %}
	{% endfor %}
				</div>
			</div>
		</section>
	{% assign slide_index = slide_index | plus: 1 %}
	{% elsif content_type == 'content' %}
	<section class="content-data-section" data-section-no={{i}}>
		<div class="wrapper">
				<h2>{{content_data_options[content_data_index]}}</h2>
				<p>{{content_data_data[content_data_index]}}</p>
			{% assign content_data_index = content_data_index | plus: 1 %}
		</div>
	</section>
	{% assign content_index = content_index | plus: 1 %}
	{% elsif content_type == 'collection' %}
		<section class="collection-list-section" data-section-no={{i}}>
			<div class="container">
				<h3 class="section-title">
						พันธมิตรของเรา
					</h3>
					<!--<div class="section-title-details">Our partners</div>-->
			<ul class="collection-list-wrapper row collection-list-slide">
				<!-- original structure  but removed "%" symbol 
				{ for col_list in collection_lists offset: collection_list_index }
					{ if col_list }
					<li class="to-half">
						<a href="{{website.site_url}}collections/{{col_list.url}}" class="collection-list-item" >
							<div class="collection-list-image" style="background-image: url({{ website.pic_url }}{{ col_list.pic_url }});">
							</div>
							<div class="collection-list-info">
								<span class="collection-list-item__name">{{col_list.name}}</span>
								<span class="collection-list-item__view">ดูทั้งหมด</span>
							</div>
						</a>
					</li>
					{ endif }
					{ assign collection_list_index = collection_list_index | plus: 1 }
				{ endfor } -->
				
				<!-- Modified Structure -->
				
				{% for collection_lists in collection_lists_array offset : collection_list_index  limit: 1 %}
					{% for col_list in collection_lists offset: 0 %}{% if col_list %}
					<li class="col col-md-2">
						<a href="{{website.site_url}}collections/{{col_list.url}}" class="collection-list-item" >
							<div class="collection-list-image" style="background-image: url({{ website.pic_url }}{{ col_list.pic_url }});">
							</div>
							<div class="collection-list-info">
								<span class="collection-list-item__name">{{col_list.name}}</span>
							</div>
						</a>
					</li>{% endif %}{% endfor %}
				{% endfor %}{% assign collection_list_index = collection_list_index | plus: 1 %}
			</ul>
			<div class="text-center">
          	<a href="{{website.site_url}}collections" class="btn">ดูทั้งหมด</a>
          </div>
			</div>
		</section>
	{% else %}
	{% endif %}
	{% assign i = i | plus: 1 %}
{% endfor %}
	{% if website.edit_verified == 0 %}
	{% comment %}
      <section class="news-section">
        <div class="container">
          <h3 class="section-title">
			ข่าวสารและกิจกรรม
          </h3>
          <!--<div class="section-title-details">
           ติดตามข่าวสารล่าสุดเกี่ยวกับโพลีเมอร์และพลาสติก
          </div>-->
		  <ul class="collection-list-wrapper blog-list row">
		  {% if all_blogs %}
			{% for blog in all_blogs %}
				{% assign blog_type = blog.type %}
				{% assign blog_pic = blog.main_pic_id %}
				<li class="col-6 col-md-4">
					<!--<a href="{{website.site_url}}blogs/{{blog_types[blog_type]}}/{{blog.url}}" class="collection-list-item" >-->
					<a href="{{website.site_url}}blogs/{{blog.url}}" class="collection-list-item" >
						<div class="collection-list-image" style="background-image: url({{theme_pics[blog_pic].web_src}});">
						</div>
						<div class="collection-list-info">
							<span class="collection-list-item__name">{{blog.header}}</span>
						</div>
					</a>
				</li>
			{% endfor %}
		  {% endif %}
		  </ul>
          <div class="text-center">
          	<a href="{{website.site_url}}blog_types/news" class="btn">ดูทั้งหมด</a>
          </div>
        </div>
      </section>
	  {% endcomment %}
	  {% endif %}
	  
	  <section class="partners">
        <div class="container">
				<h3 class="section-title">
						พันธมิตรของเรา
					</h3>
          <div class="row">
			<div class="col text-center">
				<img src="https://uniontoy.myvendday.com/uploads/item_pics/672_large.png" style="max-width:150px">
				<img src="https://uniontoy.myvendday.com/uploads/item_pics/670_large.jpg" style="max-width:150px">
				<img src="https://uniontoy.myvendday.com/uploads/item_pics/703_large.jpg" style="max-width:150px">
				<img src="https://uniontoy.myvendday.com/uploads/item_pics/704_large.jpg" style="max-width:150px">
				<img src="https://uniontoy.myvendday.com/uploads/item_pics/705_large.jpg" style="max-width:150px">
				<img src="https://uniontoy.myvendday.com/uploads/item_pics/757_large.jpg" style="max-width:150px">
				<img src="https://uniontoy.myvendday.com/uploads/item_pics/758_large.jpg" style="max-width:150px">
			</div>
		</div>
	    <div>
	  </section>
	  
	  {% comment %}
	 <section class="main-data" >
		<div class="container">
			<div class="row">
				<div class="col text-center oil-price-center">
					<!--<iframe style="height: 497px;" scrolling="no" src="https://oilprice.com/freewidgets/get_oilprices_chart/45/4"></iframe>-->
					<script type="text/javascript" src="https://www.oil-price.net/TABLE2/gen.php?lang=en"> </script>
					<noscript> To get the WTI <a href="http://www.oil-price.net/dashboard.php?lang=en#TABLE2">oil price</a>, please enable Javascript.</noscript>	
				</div>
				<div class="col text-center">
					<table class="table table-responsive">
						{% if website.current_lang == "en" %}
							<thead>
								<tr>
									<th colspan="3">Daily Exchange Rate : USD/Thai - {{ extra_params.period }}</th>
								</tr>
								<tr>
									<th colspan="3">{{ extra_params.uoq_en }}</th>
								</tr>
								<tr>
									<th>Buying Sight</th>
									<th>Buying Transfer</th>
									<th>Selling</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>{{ extra_params.buy }}</td>
									<td>{{ extra_params.buy_transfer }}</td>
									<td>{{ extra_params.sell }}</td>
								</tr>
							</tbody>
						{% else %}
							<thead>
								<tr>
									<th colspan="3">อัตราแลกเปลี่ยนเฉลี่ย : USD/Thai - {{ extra_params.period }}</th>
								</tr>
								<tr>
									<th colspan="3">{{ extra_params.uoq_th }}</th>
								</tr>
								<tr>
									<th>ตั๋วเงิน</th>
									<th>เงินโอน</th>
									<th>ขาย</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>{{ extra_params.buy }}</td>
									<td>{{ extra_params.buy_transfer }}</td>
									<td>{{ extra_params.sell }}</td>
								</tr>
							</tbody>
						
						{% endif %}
					</table>
				</div>
			</div>
		</div>
	 </section>
	 {% endcomment %}
	  
	   <section class="main-data" >
		<div class="container">
			<div class="row">
					{% assign additional_data = website.additional_configs_data %}
					{% for subDat in additional_data %}
						{% if subDat.key == "uniontoys_fx" %}
							{% assign uniontoys_fx = subDat.value %}
						{% elsif subDat.key == "uniontoys_oil" %}
							{% assign uniontoys_oil = subDat.value %}
						{% elsif subDat.key == "uniontoys_weekly" %}
							{% assign uniontoys_weekly = subDat.value %}
						{% endif %}
					{% endfor %}
				<div class="col-lg-6 col-md-12 col-sm-12">
					{% comment %}
						<script type="text/javascript" src="https://www.oil-price.net/TABLE2/gen.php?lang=en"> </script>
						<noscript> To get the WTI <a href="http://www.oil-price.net/dashboard.php?lang=en#TABLE2">oil price</a>, please enable Javascript.</noscript>
					{% endcomment %}
					{% if uniontoys_oil %}
						<h3 class="text-center">ราคาน้ำมัน</h3>
						<div class="text-center">
							<img src="{{uniontoys_oil}}" class="mx-auto" alt='Uniontoys Oil Price Update - {{ "now" | date: "%d-%m-%Y" }}' style="max-width:80%">
						</div>
					{% endif %}
				</div>
				<div class="col-lg-6 col-md-12 col-sm-12">
					{% if uniontoys_fx %}
						<h3 class="text-center">อัตราแลกเปลี่ยน</h3>
						<div class="text-center">
							<img src="{{uniontoys_fx}}" class="mx-auto"  alt='Uniontoys Currency Exchange - {{ "now" | date: "%d-%m-%Y" }}' style="max-width:80%;">
						</div>
					{% endif %}
						{% comment %}
					<table class="table table-responsive">
							{% if website.current_lang == "en" %}
								<thead>
									<tr>
										<th colspan="3">Daily Exchange Rate : USD/Thai - {{ extra_params.period }}</th>
									</tr>
									<tr>
										<th colspan="3">{{ extra_params.uoq_en }}</th>
									</tr>
									<tr>
										<th>Buying Sight</th>
										<th>Buying Transfer</th>
										<th>Selling</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td>{{ extra_params.buy }}</td>
										<td>{{ extra_params.buy_transfer }}</td>
										<td>{{ extra_params.sell }}</td>
									</tr>
								</tbody>
							{% else %}
								<thead>
									<tr>
										<th colspan="3">อัตราแลกเปลี่ยนเฉลี่ย : USD/Thai - {{ extra_params.period }}</th>
									</tr>
									<tr>
										<th colspan="3">{{ extra_params.uoq_th }}</th>
									</tr>
									<tr>
										<th>ตั๋วเงิน</th>
										<th>เงินโอน</th>
										<th>ขาย</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td>{{ extra_params.buy }}</td>
										<td>{{ extra_params.buy_transfer }}</td>
										<td>{{ extra_params.sell }}</td>
									</tr>
								</tbody>
							
							{% endif %}
					</table>
						{% endcomment %}
				</div>
			</div>
		</div>
	 </section>
	  
	  {% if website.edit_verified == 0 %}
      <section class="news-section">
        <div class="container">
          <h3 class="section-title">
           ข่าวสารและกิจกรรม
          </h3>
          <!--<div class="section-title-details">
         ติดตามข่าวสารล่าสุดเกี่ยวกับโพลีเมอร์และพลาสติก
          </div>-->
		  <ul class="collection-list-wrapper blog-list row">
		  {% if all_blogs %}
			{% assign loopRow = 0 %}
			{% for blog_data in all_blogs%} 
					{% assign blog_type = blog_data.type %}
					{% assign blog_pic = blog_data.main_pic_id %}
					{% assign blog_title = blog_data.header %}
					{% if blog_type == '1' %}
					<li class="col-6 col-md-4">
						<!--<a href="{{website.site_url}}blogs/{{blog_types[blog_type]}}/{{blog.url}}" class="collection-list-item" >-->
						<a href="{{website.site_url}}blogs/{{blog_data.url}}" class="collection-list-item" >
							<div class="collection-list-image" style="background-image: url({{theme_pics[blog_pic].web_src}});">
							</div>
							<div class="collection-list-info">
								<span class="collection-list-item__name">{{blog_data.header}}</span>
							</div>
						</a>
					</li>
					{% endif %}
			{% endfor %}
		  {% endif %}
		  </ul>
          <div class="text-center">
          	<a href="{{website.site_url}}blog_types/news" class="btn">ดูทั้งหมด</a>
          </div>
        </div>
      </section>
	  {% endif %}
	  
	  
	  {% if website.edit_verified == 0 %}
	   <section class="news-section">
        <div class="container">
          <h2 class="section-title">
			Price Guide
          </h2>
          <div class="text-center">
          	<h3>เม็ดพลาสติกราคาพิเศษ<a href="{{website.site_url}}blog_types/price-guide" class=""> Click </a></h3>
          </div>
        </div>
      </section>
	  {% endif %}
	  
	  {% if website.edit_verified == 0 %}
      <section class="news-section">
        <div class="container">
          <h3 class="section-title">
           Uniontoys Weekly
          </h3>
          <!--<div class="section-title-details">
           ข้อมูลเชิงลึกและสรุปรายสัปดาห์ของโลกโพลิเมอร์
          </div>-->
		  <ul class="collection-list-wrapper blog-list row">
		  {% if all_blogs %}
			{% for blog in all_blogs %}
				{% assign blog_type = blog.type %}
				{% assign blog_pic = blog.main_pic_id %}
				{% if blog_type == 2 %}
				<li class="col-6 col-md-4">
					<!--<a href="{{website.site_url}}blogs/{{blog_types[blog_type]}}/{{blog.url}}" class="collection-list-item" >-->
					<a href="{{website.site_url}}blogs/{{blog.url}}" class="collection-list-item" >
						<div class="collection-list-image" style="background-image: url({{theme_pics[blog_pic].web_src}});">
						</div>
						<div class="collection-list-info">
							<span class="collection-list-item__name">{{blog.header}}</span>
						</div>
					</a>
				</li>
				{% endif %}
			{% endfor %}
		  {% endif %}
		  </ul>
          <div class="text-center">
          	<a href="{{website.site_url}}blog_types/uniontoys-weekly" class="btn">ดูทั้งหมด</a>
          </div>
        </div>
      </section>
	  {% endif %}
	  
      <section class="contact-section">
        <div class="container">
          <div class="row">
          <div class="col text-center">
            <h2>ติดต่อเราได้ที่ +66 2 272 1444-6</h2>
            <p>จันทร์ - ศุกร์ ( 9.00 - 17.00 )</p>
          </div>
        </div>  
        </div>
			<!-- Hidden inputs for settings -->
				{% if template.carousel_delay %}
				<input type="hidden" id="slickSpeed" value="{{template.carousel_delay}}" />
				{% endif %}
				{% if template.carousel_fade %}
				<input type="hidden" id="slickFade" value="{{template.carousel_fade}}" />
				{% endif %}
			<!-- End Hidden inputs for settings -->
<style>
	.oil-price-center table{
		text-align : center !important;
	}
</style>
<script>
function checkModalDates(dateFrom,dateTo){

	var d = new Date();
	var dateCheck = d.getDate() + "/" + (d.getMonth()+1) + "/" + d.getFullYear();
	
	var d1 = dateFrom.split("/");
	var d2 = dateTo.split("/");
	var c = dateCheck.split("/");
	
	var from = new Date(d1[2], parseInt(d1[1])-1, d1[0]);  // -1 because months are from 0 to 11
	var to   = new Date(d2[2], parseInt(d2[1])-1, d2[0]);
	var check = new Date(c[2], parseInt(c[1])-1, c[0]);

	var checkValid = (check >= from && check <= to);
	if(checkValid)
	{
		setTimeout(function(){$('#bannerModal').modal('show');},1000);
	}
}
checkModalDates('12/06/2026','31/07/2026');

</script>
{% else %}
	<!-- No Structure -->
	
	nono
	
	<!-- End No Content -->
{% endif %}