SyncMadeEasy/force-app/main/default/aura/Displaysampledata/Displaysampledata.cmp

361 lines
22 KiB
Plaintext

<aura:component controller="AddDeleteController" >
<aura:attribute name="store" type="string" default="default"/>
<!--ltng:require styles="{! $Resource. datatable + '/DataTables-1.10.16/media/css/jquery.dataTables.min.css'}"
scripts="{!join(',',
$Resource.jquery224 ,
$Resource.datatable + '/DataTables-1.10.16/media/js/jquery.dataTables.min.js')
}" afterScriptsLoaded="{!c.scriptsLoaded}"/-->
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:attribute name="objecttype" type="object" />
<aura:attribute name="columns" type="List"/>
<aura:attribute name="Intervalvalue" type="string"/>
<aura:attribute name="listofprodutct" type="list" />
<aura:attribute name="Listofcontact" type="list" />
<aura:attribute name="listofcollection" type="list" />
<aura:attribute name="listoforder" type="list" />
<aura:attribute name="listofdarftorder" type="list" />
<aura:attribute name="listoflocation" type="list" />
<aura:attribute name="jsonvalue" type="string" />
<aura:attribute name="formatText" type="object" />
<aura:attribute name="OpenModel" type="boolean" default="false" />
<aura:attribute name="Doinitdone" type="boolean" default="false" />
<aura:attribute name="jsonloading" type="boolean" default="false" />
<aura:if isTrue="{!v.OpenModel}">
<div class="slds-m-around_xx-large">
<!--Use aura:if tag to display/hide popup based on isModalOpen value-->
<section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
<div class="slds-modal__container">
<header class="slds-modal__header">
<lightning:buttonIcon iconName="utility:close"
onclick="{!c.closemodal }"
alternativeText="close"
variant="bare-inverse"
class="slds-modal__close"/>
<h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate"><b>JSON Body</b></h2>
</header>
<!--Modal/Popup Box Body Starts here-->
<div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
<div id = "jsonid" aura:id="jsonid" style="color: rgb(63, 143, 47);" >
<center>
<!--div class="slds-m-around_xx-large">
<strong>Loading.. JSON</strong>
</!div-->
<img src="{!$Resource.PageLoadingGif}" style="width:30%;"></img>
</center>
</div>
</div>
<footer class="slds-modal__footer" style="padding:0;">
<div class="slds-m-around_small" >
<lightning:button iconName="utility:copy_to_clipboard"
onclick="{!c.copyHardcoreText}"
label="Copy Text to clipboard"
aura:id="btn1"/>
</div>
</footer>
</div>
</section>
<div class="slds-backdrop slds-backdrop_open"></div>
</div>
</aura:if>
<aura:if isTrue="{!v.Doinitdone}">
<lightning:card title="Sample Records" iconName="standard:dataset">
<div class="slds-m-around_x-small">
<aura:if isTrue="{!v.listofprodutct}">
<table id="tableId" class="slds-table slds-table_bordered slds-table_cell-buffer " cellspacing="0" width="100%">
<thead>
<tr data-index="products" onclick="{!c.onsectionclick}">
<th class="Sectioncolor"><strong> Products <lightning:icon aura:id="products" class="slds-m-left_x-small iconstyles" size="small" iconName="utility:chevronright"/> </strong></th>
</tr>
</thead>
<tbody id="products" style="display:none;">
<td>
<table class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sr. No</th>
<th>Shopify Id</th>
<th>title</th>
<th>Created at</th>
<th>Modified at</th>
<th>JSON</th>
</tr>
</thead>
<tbody>
<aura:iteration items="{!v.listofprodutct}" var="item" indexVar ="index">
<tr>
<td >{!index+1}</td>
<td>{!item.id}</td>
<td>{!item.title}</td>
<td>
<lightning:formattedDateTime value="{!item.created_at}"/>
</td>
<td>
<lightning:formattedDateTime value="{!item.updated_at}"/>
</td>
<td><lightning:button name="JSON" label="JSON" onclick="{!c.displayJson}" value="{!item}"></lightning:button></td>
</tr>
</aura:iteration>
</tbody>
</table>
</td>
</tbody>
</table>
</aura:if>
<aura:if isTrue="{!v.Listofcontact}">
<table id="tableId" class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr data-index="contacts" onclick="{!c.onsectionclick}">
<th class="Sectioncolor"><strong> Customers <lightning:icon aura:id="contacts" class="slds-m-left_x-small iconstyles" size="small" iconName="utility:chevronright"/> </strong></th>
</tr>
</thead>
<tbody id="contacts" style="display:none;">
<td>
<aura:if isTrue="{!v.Listofcontact}">
<table class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sr. No</th>
<th>Shopify Id</th>
<th>First Name</th>
<th>Last Name</th>
<th>Total Orders</th>
<th>JSON</th>
</tr>
</thead>
<tbody>
<aura:iteration items="{!v.Listofcontact}" var="item" indexVar ="index">
<tr>
<td>{!index+1}</td>
<td>{!item.id}</td>
<td>{!item.first_name}</td>
<td>{!item.last_name}</td>
<td>{!item.orders_count}</td>
<td><lightning:button name="JSON" label="JSON" onclick="{!c.displayJson}" value="{!item}"></lightning:button></td>
</tr>
</aura:iteration>
</tbody>
</table>
</aura:if>
</td>
</tbody>
</table>
</aura:if>
<aura:if isTrue="{!v.listofcollection}">
<table id="tableId" class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr data-index="collection" onclick="{!c.onsectionclick}">
<th class="Sectioncolor"><strong> Collections <lightning:icon aura:id="collection" class="slds-m-left_x-small iconstyles" size="small" iconName="utility:chevronright"/> </strong></th>
</tr>
</thead>
<tbody id="collection" style="display:none;">
<td>
<aura:if isTrue="{!v.listofcollection}">
<table class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sr. No</th>
<th>Shopify Id</th>
<th>Title</th>
<th>Published at</th>
<th>Updated at</th>
<th>JSON</th>
</tr>
</thead>
<tbody>
<aura:iteration items="{!v.listofcollection}" var="item" indexVar ="index">
<tr>
<td>{!index+1}</td>
<td>{!item.id}</td>
<td>{!item.title}</td>
<td>
<lightning:formattedDateTime value="{!item.published_at}"/>
</td>
<td>
<lightning:formattedDateTime value="{!item.updated_at}"/>
</td>
<td><lightning:button name="JSON" label="JSON" onclick="{!c.displayJson}" value="{!item}"></lightning:button></td>
</tr>
</aura:iteration>
</tbody>
</table>
</aura:if>
</td>
</tbody>
</table>
</aura:if>
<aura:if isTrue="{!v.listoforder}">
<table id="tableId" class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr data-index="order" onclick="{!c.onsectionclick}">
<th class="Sectioncolor"><strong> Orders <lightning:icon aura:id="order" class="slds-m-left_x-small iconstyles" size="small" iconName="utility:chevronright"/> </strong></th>
</tr>
</thead>
<tbody id="order" style="display:none;" >
<td>
<aura:if isTrue="{!v.listoforder}">
<table class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sr. No</th>
<th>Shopify Id</th>
<th>Order Number</th>
<th>Total Price</th>
<th>Total Discounts</th>
<th>JSON</th>
</tr>
</thead>
<tbody>
<aura:iteration items="{!v.listoforder}" var="item" indexVar ="index">
<tr>
<td>{!index+1}</td>
<td>{!item.id}</td>
<td>{!item.order_number}</td>
<td>{!item.total_price}</td>
<td>{!item.total_discounts}</td>
<td><lightning:button name="JSON" label="JSON" onclick="{!c.displayJson}" value="{!item}"></lightning:button></td>
</tr>
</aura:iteration>
</tbody>
</table>
</aura:if>
</td>
</tbody>
</table>
</aura:if>
<aura:if isTrue="{!v.listofdarftorder}">
<table id="tableId" class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr data-index="draftorder" onclick="{!c.onsectionclick}">
<th class="Sectioncolor"><strong> Draft Orders <lightning:icon aura:id="draftorder" class="slds-m-left_x-small iconstyles" size="small" iconName="utility:chevronright"/> </strong></th>
</tr>
</thead>
<tbody id="draftorder" style="display:none;" >
<td>
<aura:if isTrue="{!v.listofdarftorder}">
<table class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sr. No</th>
<th>Shopify Id</th>
<th>Name</th>
<th>Status</th>
<th>Created at</th>
<th>JSON</th>
</tr>
</thead>
<tbody>
<aura:iteration items="{!v.listofdarftorder}" var="item" indexVar ="index">
<tr>
<td>{!index+1}</td>
<td>{!item.id}</td>
<td>{!item.name}</td>
<td>{!item.status}</td>
<td>
<lightning:formattedDateTime value="{!item.created_at}"/>
</td>
<td><lightning:button name="JSON" label="JSON" onclick="{!c.displayJson}" value="{!item}"></lightning:button></td>
</tr>
</aura:iteration>
</tbody>
</table>
</aura:if>
</td>
</tbody>
</table>
</aura:if>
<aura:if isTrue="{!v.listoflocation}">
<table id="tableId" class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr data-index="location" onclick="{!c.onsectionclick}">
<th class="Sectioncolor"><strong> Locations <lightning:icon aura:id="location" class="slds-m-left_x-small iconstyles" size="small" iconName="utility:chevronright"/> </strong></th>
</tr>
</thead>
<tbody id="location" style="display:none;">
<td>
<table class="slds-table slds-table_bordered slds-table_cell-buffer" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sr. No</th>
<th>Shopify Id</th>
<th>Name</th>
<th>Country</th>
<th>Active</th>
<th>JSON</th>
</tr>
</thead>
<tbody>
<aura:iteration items="{!v.listoflocation}" var="item" indexVar ="index">
<tr>
<td>{!index+1}</td>
<td>{!item.id}</td>
<td>{!item.name}</td>
<td>{!item.country_name}</td>
<td>{!item.active}</td>
<td><lightning:button name="JSON" label="JSON" onclick="{!c.displayJson}" value="{!item}"></lightning:button></td>
</tr>
</aura:iteration>
</tbody>
</table>
</td>
</tbody>
</table>
</aura:if>
</div>
</lightning:card>
<aura:set attribute="else">
<center>
<div class="slds-m-around_xx-large">
<!--strong>Loading..</strong-->
<center>
<!--div class="slds-m-around_xx-large">
<strong>Loading.. JSON</strong>
</!div-->
<img src="{!$Resource.PageLoadingGif}" style="width: 25% !important;"></img>
</center>
</div>
</center>
</aura:set>
</aura:if>
<!--aura:iteration items="{!v.Listofcontact}" var="item" indexVar ="index">
{!index+1} &nbsp; {!item.id}&nbsp; {!item.email} &nbsp; {!item.default_address.address1} <br/>
</aura:iteration-->
<!--lightning:datatable
keyField="id"
data="{!v.Listofcontact}"
columns="{!v.columns }"
hideCheckboxColumn="true"
showRowNumberColumn="true"
/-->
</aura:component>