I want to implement a function to display a status active when the expiration date is not hit, and a status inactive when it's hit - laravel-8

My greetings to everybody, actually I want to write a function or a condition to display status active when the expiration date is not hit, and a status inactive when it's hit.
Ref No
Beneficiaire
Date expiration
Status
Actions
#foreach($contrats as $contrat)
{{$contrat->reference}}
{{$contrat->beneficiare}}
{{$contrat->date_exp}}
Inactive
Confirmé
<a href="#">
<i>Voir</i>
</a>
#endforeach
`

Related

Trouble Displaying a Product's Price in Stencil Conditional Statement

I'm using the Cornerstone theme in BigCommerce. On my product page, I need to hide pricing unless the end user is logged in. BigCommerce has this feature, but it's all or nothing and I only want to restrict certain items from displaying their price. I am using a custom field at the product level named HidePrice. This custom field has either a True or False defined for each product on my site. There are three conditions I need to account for...
The end user is logged in: Display the price regardless of what the HidePrice value is
The product's HidePrice value = false: Display the product's price
The product's HidePrice value = true and the end user is NOT logged in: Suppress the product's price and display an alternate "Too low to show" message.
Here's my code that isn't quite working...
<div class="productView-price">
{{#if customer}}
{{#if product.can_purchase}}
<p class="productView-price">
<span>Price: {{product.price.without_tax.value}}</span>
</p>
{{/if}}
{{else}}
{{#filter product.custom_fields 'HidePrice' property='name' }}
{{#if (toLowerCase value) '==' 'true'}}
<div class="too-low-to-show">This product is priced too low to show!</div>
{{else}}
<p class="productView-price">
<span>Price: {{product.price.without_tax.value}}</span>
</p>
{{/if}}
{{/filter}}
{{/if}}
</div>
The piece I can't seem to get working is condition #1 above (The product's HidePrice value = false: Display the product's price). Conditions #2 & #3 work just fine but the price simply never displays when the requirements of condition #1 are met. Oddly, the "Price:" label I've pre-pended just before the price handlebar will display but the price handlebar itself seems to be ignored by BigCommerce. I have found that if I use the same price handlebar outside of my conditional statement, it will render on the page. I'm baffled by this one. Any help would be greatly appreciated. Thanks!
I believe the issue here is simply scope. Once you enter the filter condition, you have left the global scope and entered the product.custom_fields scope. You no longer have access to the product object. A simple fix for this should be to go back up a level by appending "../" in front of product.price.
<div class="productView-price">
{{#if customer}}
{{#if product.can_purchase}}
<p class="productView-price">
<span>Price: {{product.price.without_tax.value}}</span>
</p>
{{/if}}
{{else}}
{{#filter product.custom_fields 'HidePrice' property='name' }}
{{#if (toLowerCase value) '==' 'true'}}
<div class="too-low-to-show">This product is priced too low to show!</div>
{{else}}
<p class="productView-price">
<span>Price: {{../product.price.without_tax.value}}</span>
</p>
{{/if}}
{{/filter}}
{{/if}}
</div>

Aurelia - bind only once showing the title in repeater

I have a list of users, every users have some roles. In aurelia html file I want to categorize the users. The incoming data has all the users chronologically by roles.
So basically, if the user has a role1, show section title ROLE1 and list those users, then show ROLE2 and list those users.
I tried to use this:
<p if.bind="user.role1">ROLE1</p>
<p if.bind="user.role2">ROLE2</p>
and here is my full code:
<template repeat.for="user of users">
<p if.bind="user.role1">ROLE1</p>
<p if.bind="user.role2">ROLE2</p>
<checkbox-input label="${user.name}" checked-value.two-way="user['selected']"></checkbox-input>
</template>
The problem is, that the titles ROLE1 or ROLE2 are showing above each user as this in a repeater, but I need to show them only once. I tried to use also if.bind.one-time but that works not.
Finally, I solved it different way - I used the same repeaters 2 times. The titles I put above the repeater and inside the checkboxes I used if.bind="user.role1" or role2 for the second one. This way it works, however I wanted to solve it easier, but finally this works.
<p>ROLE1</p>
<template repeat.for="user of users">
<checkbox-input if.bind="user.role1" label="${user.name}" checked-value.two-way="user['selected']"></checkbox-input>
</template>
<p>ROLE2</p>
<template repeat.for="user of users">
<checkbox-input if.bind="user.role2" label="${user.name}" checked-value.two-way="user['selected']"></checkbox-input>
</template>

ngIf block is loading for few seconds and then hiding

We have search functionality, with search criteria and table below with search result. I am trying to add "No record found" section for search functionality when there is no records, I have added ngIf condition. But the table has pagination feature as well. we have implemented server side pagination. So wen we have around 1000 records with 10 records per page. It taking time to load data and its showing "No records found" section for few seconds and then loading the data. How will I resolve this? I tried with ngTemplate as well, but I am facing the same issue.
<div *ngIf="resultArray!==null && resultArray!==undefined && resultArray.length>0; else displayNoRecordFoundBlock">
<table>
</table>
</div>
<ng-template #displayNoRecordFoundBlock>
<div class="no-result-found" >
No records found
</div>
</ng-template>
This is the code I have used.

How auto refresh component when data updated from api, without page refresh

I’m trying to make component like a LIKE count,
so,
i have a object is name (LIST) which i get from api, in my LIST object have property total_like which default value is 0, when i click to like button i make post request to api and in api my total_like value rising to 1 and 2 and etc.
in my view i’m displaying the like count with {{item.total_like}} everything work well to this point.
problem is item.total_like value updating only when i refresh the page, but i want to show new value of this property without refreshing page.
how can i figure out with it ?
regards
Maybe you can use the event modifiers to prevent page reloading, examples are...
<button type="submit" v-on:click.prevent="addLike" >
<button type="submit" v-on:submit.prevent="addLike">
or if you want to use the shorthand
<button type="submit" #click.prevent="addLike" >
<button type="submit" #submit.prevent="addLike">
Hope this helps.

Prestashop how to make modification on Add and Minus button in shopping cart

who knows what file controls the function for add and minus button in the shopping cart? I want to change the qty that is added or minus after any buttons is clicked.
this is the code for the ADD button
<a rel="nofollow" class="" id="" href="{$link->getPageLink('cart', true, NULL, "add=1&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&token={$token_cart}")|escape:'html':'UTF-8'}" title="{l s='Add' mod='advancedcheckout'}"><span><i class="fa fa-plus"></i></span></a>
Changing add=1 is not making any changes. So At start I thought it was a JS or AJAX file, but the button continues working even after I deleted all classes and ID. So I think all this trick is made by the code in href=""
But where I can make the changes for the qty added? Who knows?
If I good understand. You should look at those file:
themes/defaylt-theme/js/product.js: line 424
themes/defaylt-theme/js/product.js: line 408
You have to check the
cart-summary.js
in your theme/js/ folder. This will contain the + and the - button events
function upQuantity
function downQuantity