identity_card.ftl

 1   <#--
 2     Macro: identityCard
 3     Renders a card UI for identity details.
 4     @param identity The main data object containing the identity's details.
 5     @param index The index of the current identity in the list.
 6     @param merge Optional boolean parameter to conditionally render merge-related UI elements.
 7     @param class Optional CSS classes for customization.
 8     @param width Optional width for the card.
 9     @returns A rendered identity card based on provided parameters.
 10   -->
 11   <#macro identityCard identity identity_workflow firstIdentity index serviceContract merge=false candidate=false class="" width="">
 12       <#assign familyNameAttr = identity.attributes?filter(a -> a.key == "family_name")?first!{}>
 13       <#assign firstNameAttr = identity.attributes?filter(a -> a.key == "first_name")?first!{}>
 14       <#assign emailAttr = identity.attributes?filter(a -> a.key == "email")?first!{}>
 15       <#assign birthdateAttr = identity.attributes?filter(a -> a.key == "birthdate")?first!{}>
 16       <div class="lutece-compare-item-container border-end p-3 position-relative <#if index == 0>bg-primary-subtle border border-primary-subtle rounded-start-5<#else> border-top border-bottom</#if><#if !merge && index == 0> border-2 border-end-dashed </#if><#if !merge && index != 0> border-dark-subtle<#elseif merge && index != 0> border-warning-subtle</#if> ${class}" style="<#if width!=''>width:${width}</#if>">
 17           <div class="lutece-compare-item card p-0 rounded-5 shadow-xl mb-0">
 18               <div class="py-4 text-center">
 19                   <h3 class="px-2 text-truncate">
 20                       <#if familyNameAttr??>
 21                           <#if familyNameAttr.value?has_content>
 22                               ${familyNameAttr.value}
 23                           <#else>
 24                               <span class="text-warning">Vide</span>
 25                           </#if>
 26                       <#else>
 27                           <span class="text-warning">Inexistant</span>
 28                       </#if>
 29                       <#if firstNameAttr??>
 30                           <#if firstNameAttr.value?has_content>
 31                               ${firstNameAttr.value}
 32                           <#else>
 33                               <span class="text-warning">Vide</span>
 34                           </#if>
 35                       <#else>
 36                           <span class="text-warning">Inexistant</span>
 37                       </#if>
 38                   </h3>
 39                   <div class="d-flex flex-row justify-content-center align-items-center mt-2">
 40                       <div class="mr-2">
 41                           <#if identity.quality.quality?is_number>
 42                               <#assign qualityPercent=(identity.quality.quality * 100)?round>
 43                               <#if qualityPercent gt 79>
 44                                   <@tag color="success" >#i18n{identityimport.quality} : ${qualityPercent}%</@tag>
 45                               <#elseif qualityPercent gt 50 && qualityPercent lt 80>
 46                                   <@tag color="warning">#i18n{identityimport.quality} : ${qualityPercent}%</@tag>
 47                               <#else>
 48                                   <@tag color="danger">#i18n{identityimport.quality} : ${qualityPercent}%</@tag>
 49                               </#if>
 50                           <#else>
 51                               <@tag color="danger">-</@tag>
 52                           </#if>
 53                       </div>
 54                       <div>
 55                           <#if !candidate>
 56                               <#if identity.monParisActive>
 57                                   <@tag color="success" class="ms-2">MON PARIS</@tag>
 58                               <#else>
 59                                   <@tag color="danger" class="ms-2 text-decoration-line-through">MON PARIS</@tag>
 60                               </#if>
 61                           </#if>
 62                       </div>
 63                       <div>
 64                           <#if !candidate>
 65                               <#if identity.customerId??>
 66                                   <@tag color="info" class="ms-2" params="data-toggle='tooltip' data-placement='top' title='${identity.customerId}'">CUID</@tag>
 67                               </#if>
 68                           </#if>
 69                       </div>
 70                   </div>
 71                   <div class="mt-3">
 72                       <#if candidate>
 73                           <button type="button" class="btn btn-warning" data-name="identity-cuid-${index}" data-cuid="${identity.customerId!''}">
 74                               #i18n{identityimport.import_identity.importedIdentity}
 75                           </button>
 76                       <#else>
 77                           <#if merge>
 78                               <button type="button" class="btn btn-success" data-name="identity-cuid-${index}" data-cuid="${identity.customerId!''}">
 79                                   #i18n{identityimport.import_identity.selectedIdentity}
 80                               </button>
 81                           <#else>
 82                               <button type="button" class="btn btn-success" data-name="identity-cuid-${index}" data-cuid="${identity.customerId!''}">
 83                                   ${identity.duplicateDefinition.duplicateSuspicion.duplicateRuleCode!''}
 84                               </button>
 85                           </#if>
 86                       </#if>
 87                   </div>
 88               </div>
 89               <ul class="list-group list-group-flush rounded-bottom-5">
 90                   <#list key_list as current_key >
 91                       <#assign attributeDefinition = (serviceContract.attributeDefinitions?filter(a -> a.keyName == current_key)?first)!{} />
 92                       <li class="list-group-item d-flex justify-content-center align-items-center p-0 border-start-0 border-end-0" data-name="${current_key}" data-key="${current_key}" style="min-height:55px">
 93                           <div class="w-100 d-flex">
 94                               <#assign attributesList=identity.attributes?filter(a -> a.key == current_key)>
 95                               <#if (!merge && index != 0) || (merge && index == 0)>
 96                                   <#assign firstIdentityAttr=firstIdentity.attributes?filter(a -> a.key == current_key)?first!{}>
 97                               </#if>
 98                               <#if attributesList?size gt 0>
 99                                   <#list attributesList as attr>
 100                                       <div class="flex-1 flex-grow-1 py-2 px-3 text-break">
 101                                           <div class="opacity-50">
 102                                               ${current_key} <#if !attributeDefinition.attributeRight.writable> <i class="ti ti-x" style="color: red"></i> </#if>
 103                                           </div>
 104                                           <div class="fw-bold attribute-container">
 105                                               <h3 class="attribute-value mb-0 fw-bold <#if !attr.value?has_content>text-warning</#if> <#if ((!merge && index != 0) || (merge && index == 0)) && ( !(firstIdentityAttr.value?has_content) || firstIdentityAttr.value != attr.value )>text-danger</#if>">
 106                                                   <#if attr.value?? && attr.value?has_content>
 107                                                       ${attr.value}
 108                                                   <#else>
 109                                                       Vide
 110                                                   </#if>
 111                                               </h3>
 112                                           </div>
 113                                       </div>
 114                                       <div class="flex-1 border-start py-2 px-2 text-break" style="width:110px;min-width:110px;max-width:110px;">
 115                                           <#if attr.certificationDate??>
 116                                               <div class="text-center opacity-50">
 117                                                   ${attr.certificationDate?date}
 118                                               </div>
 119                                           </#if>
 120                                           <#if attr.certifier??>
 121                                               <div class="certifier text-truncate text-center w-100">
 122                                                   <span class="fw-medium">
 123                                                       ${attr.certifier}
 124                                                   </span>
 125                                               </div>
 126                                           </#if>
 127                                       </div>
 128                                   </#list>
 129                               <#else>
 130                                   <div class="flex-1 flex-grow-1 py-2 px-3 text-break">
 131                                       <div class="opacity-50">
 132                                           ${current_key} <#if !attributeDefinition.attributeRight.writable> <i class="ti ti-x" style="color: red"></i> </#if>
 133                                       </div>
 134                                       <div class="fw-bold attribute-container">
 135                                           <h3 class="attribute-value mb-0 fw-bold text-warning">
 136                                               Inexistant
 137                                           </h3>
 138                                       </div>
 139                                   </div>
 140                                   <div class="flex-1 border-start py-2 px-2 text-break" style="width:110px;min-width:110px;max-width:110px;"></div>
 141                               </#if>
 142                           </div>
 143                       </li>
 144                   </#list>
 145               </ul>
 146               <div class="py-4 text-center">
 147                   <#if !merge>
 148                       <#if index != 0>
 149                           <@aButton href="jsp/admin/plugins/identityimport/ManageBatchs.jsp?view_completeIdentity=&id_identity=${identity_workflow.resource.id}&selected_customer_id=${identity.customerId!''}" title="#i18n{identityimport.select_identities.buttonMergeDuplicate}" alt="#i18n{identityimport.select_identities.buttonMergeDuplicate}"/>
 150                       <#else>
 151                           <#list identity_workflow.actions as action >
 152                               <#if action.id == 4 >
 153                                   <@aButton href="jsp/admin/plugins/identityimport/ManageBatchs.jsp?action=processIdentityAction&actionId=${action.id}&id=${identity_workflow.resource.id}" title="${action.name}" alt="${action.name}"/>
 154                               </#if>
 155                           </#list>
 156                       </#if>
 157                   </#if>
 158               </div>
 159           </div>
 160       </div>
 161   </#macro>