edms2023/resources/views/document-workflows/workflow.blade.php

602 lines
30 KiB
PHP

@php
if($workflow_document->workflow_type_id == 1)
$type_para = "Incoming";
elseif($workflow_document->workflow_type_id == 2)
$type_para = "Outgoing";
elseif($workflow_document->workflow_type_id == 3)
$type_para = "Internal";
else
$type_para = "Incoming";
@endphp
<div class="page-header">
<h1 class="page-title">{{ __('View Document Workflow') }}</h1>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="javascript: void(0);">{{ __('Dashboard') }}</a></li>
<li class="breadcrumb-item"><a href="{{ route('documents', $type_para) }}">{{ __(''.$type_para.' Documents') }}</a></li>
<li class="breadcrumb-item active">{{ __('View '.$type_para.' Document Workflow') }}</li>
</ol>
<div class="page-header-actions">
<a class="btn btn-dark" href="{{ route('documents', $type_para) }}">
<i class="icon wb-arrow-left" aria-hidden="true"></i>
<span class="hidden-sm-down">{{ __('Back To '.$type_para.' Document') }}</span>
</a>
</div>
</div>
<div class="page-content">
<div class="row">
<!-- LEFT SECTION -->
<div class="col-xxl-8 col-xl-8 col-lg-12">
<!-- Timeline -->
<ul class="timeline timeline-simple" id="workflow_ul">
@if(!empty($workflowDocumentProcess))
@php
$first=false;
@endphp
@foreach($workflowDocumentProcess as $key => $proces)
@if($first == false)
<li class="timeline-period">
{{ $proces->assign_date != '' ? date('d-m-Y', strtotime($proces->assign_date)) : '' }}
<div class="card">
@php
$document = App\WorkflowDocument::where('id', $proces->workflow_document_id)->first();
@endphp
<h4 class="text-primary float-center">{{ ($document) ? $document->getRegNumber(): '' }}</h4>
</div>
</li>
@php $first=true; @endphp
@endif
@if($key==0)
@php
$user = App\User::getUserDocument()->where('users.id', '=', $proces->assign_by)->first();
$status = user_status($user); // helper function;
@endphp
<li class="timeline-item" id="-1">
<div class="timeline-dot" data-placement="right"></div>
<div class="timeline-content">
<div class="card">
<div class="card-block p-10">
<div class="media">
@if($user->profile_picture && trim($user->profile_picture)!='' && file_exists(public_path('uploads/user_folder/'.$user->profile_picture)))
<div class="pr-0 pr-sm-20 align-self-center">
<div class="avatar {{ $status['class'] }}" data-toggle="tooltip" data-placement="bottom" title="{{ $status['status'] }}">
<img src='{{asset(env("UPLOADS_FOLDER") . "/" . env("USER_FOLDER") . "/" . $user->profile_picture)}}' alt="Profile Picture" >
<i class="avatar avatar-busy"></i>
</div>
</div>
@endif
<div class="media-body align-self-center">
<h5 class="mt-0 mb-5">
{{ $user->getFullName()}}
</h5>
<p class="user-job">
<button type="button" class="btn btn-warning mb-1"><i class="icon wb-user-circle" aria-hidden="true"></i> <b>{{ dataTranslation($user->role_name) }}</b></button>&nbsp;&nbsp;
@if($user->department_id !='' && $user->department_id > 0)
@php
$user_department=App\Department::where('id', $user->department_id)->first();
@endphp
@if($user_department)
<br>
<button type="button" class="btn btn-info"><i class="icon wb-briefcase" aria-hidden="true"></i> <b>{{ dataTranslation($user_department->name) }}</b></button>
@endif
@endif
</p>
</div>
</div>
<div class="row">
<div class="col-md-12 table-responsive">
<table class="table process-table">
<tbody>
<tr>
<td><label class="form-control-label"><b>{{ __('Date') }}:</b></label></td>
<td>{{ $workflow_document->getRegistrationDate() }}</td>
</tr>
<tr>
<td><label class="form-control-label"><b>{{ __('Status') }}:</b></label></td>
<td>{{ __('Completed') }}</td>
</tr>
<tr>
<td><label class="form-control-label"><b>{{ __('Action') }}:</b></label></td>
<td>{{ $workflow_document->workflow_type_id != 1 ? __('Send For approval') : __('Registered') }}</td>
</tr>
<tr>
<td><b>{{ __('Comment') }}:</b></td>
<td><?php echo nl2br($workflow_document->comment)?></td>
</tr>
<tr>
<td colspan="2">
@php
$document_file = App\WorkflowDocumentFile::where('workflow_document_id', $proces->workflow_document_id)->where('uploaded_by', $proces->assign_by)->where('process_id', $proces->id)->orderBy('id', 'desc')->first();
@endphp
@if($document_file !== null && $document_file->version > 0 && $workflow_document->workflow_type_id == 2)
<button type="button" class="btn btn-info"><i class="icon fa fa-plus-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_file->version }}</b></button>
@endif
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</li>
@php
$user = App\User::getUserDocument()->where('users.id', '=', $proces->user_id)->first();
$status = user_status($user); // helper function;
@endphp
<li class="timeline-item timeline-reverse" id="{{ $key }}">
<div class="timeline-dot bg-green-500" data-placement="left" data-toggle="tooltip" data-trigger="hover" data-original-title="2 Days ago"></div>
<div class="timeline-content">
<div class="card">
<div class="card-block p-10">
@if($proces->user_type == 'S')
<h5 class="mt-0 mb-5">
<b>{{ __('SUPPORTER USERS') }}:</b><br>
</h5>
@endif
<div class="media">
@if($user->profile_picture && trim($user->profile_picture)!='' && file_exists(public_path('uploads/user_folder/'.$user->profile_picture)))
<div class="pr-0 pr-sm-20 align-self-center">
<div class="avatar {{ $status['class'] }}" data-toggle="tooltip" data-placement="bottom" title="{{ $status['status'] }}">
<img src='{{asset(env("UPLOADS_FOLDER") . "/" . env("USER_FOLDER") . "/" . $user->profile_picture)}}' alt="Profile Picture" >
<i class="avatar avatar-busy"></i>
</div>
</div>
@endif
<div class="media-body align-self-center">
<h5 class="mt-0 mb-5">
{{ $user->getFullName()}}
</h5>
<p class="user-job">
<button type="button" class="btn btn-warning mb-1"><i class="icon wb-user-circle" aria-hidden="true"></i> <b>{{ dataTranslation($user->role_name) }}</b></button>&nbsp;&nbsp;
@if($user->department_id !='' && $user->department_id > 0)
@php
$user_department=App\Department::where('id', $user->department_id)->first();
@endphp
@if($user_department)
<br>
<span type="button" class="btn btn-info"><i class="icon wb-briefcase" aria-hidden="true"></i> <b>{{ dataTranslation($user_department->name) }}</b></span>
@endif
@endif
</p>
</div>
</div>
<div class="row">
<div class="col-md-12 table-responsive">
<table class="table process-table">
<tbody>
<tr>
<td><label class="form-control-label"><b>{{ __('Date') }}:</b></label></td>
<td>{{ $proces->getProcessDate() }}</td>
</tr>
<tr>
<td><label class="form-control-label"><b>{{ __('Status') }}:</b></label></td>
<td>{{ __($proces->getProcessUserType()) }}</td>
</tr>
<tr>
<td><label class="form-control-label"><b>{{ __('Action') }}:</b></label></td>
<td>{{ __($proces->getProcessAction()) }}</td>
</tr>
<tr>
<td><b>{{ __('Comment') }}:</b></td>
<td><?php echo nl2br($proces->comment)?></td>
</tr>
<tr>
<td colspan="2">
@php
$reply_doce = App\WorkflowDocument::where('reply_for', $proces->workflow_document_id)->first();
@endphp
@if($proces->status=='A')
@php
$document_last_file = App\WorkflowDocumentFile::where('workflow_document_id', $proces->workflow_document_id)->orderBy('id', 'desc')->first();
@endphp
<div class="form-group col-md-12 px-1 pb-0 mb-0">
<button type="button" class="btn btn-success"><i class="icon fa fa-check-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_last_file->version }}</b></button>
<button type="button" class="btn btn-success" {{($document_last_file->isSigned()) ? '' : 'hidden'}} title="{{$document_last_file->uploader_name}}" ><i class="icon wb-lock" aria-hidden="true"></i></button>
</div>
@elseif($workflow_document->workflow_type_id == 2)
@php
$document_file = App\WorkflowDocumentFile::where('workflow_document_id', $proces->workflow_document_id)->where('uploaded_by', $proces->user_id)->where('process_id',$proces->id)->orderBy('id', 'desc')->first();
@endphp
@if($document_file !== null && $document_file->version > 0)
<div class="form-group col-md-12 px-1 pb-0 mb-0">
<button type="button" class="btn btn-info"><i class="icon fa fa-plus-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_file->version }}</b></button>
<button type="button" class="btn btn-success" {{($document_file->isSigned()) ? '' : 'hidden'}} title="{{$document_file->uploader_name}}"><i class="icon wb-lock" aria-hidden="true"></i></button>
</div>
@endif
@elseif($proces->id == $workflowDocumentProcess->last()->id && !empty($reply_doce))
@php
$document_file = App\WorkflowDocumentFile::where('workflow_document_id', $reply_doce->id)->orderBy('id', 'asc')->first();
@endphp
@if($document_file !== null && $document_file->version > 0)
<div class="form-group col-md-12 px-1 pb-0 mb-0">
<button type="button" class="btn btn-info"><i class="icon fa fa-plus-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_file->version }}</b></button>
<button type="button" class="btn btn-success" {{($document_file->isSigned()) ? '' : 'hidden'}} title="{{$document_file->uploader_name}}" ><i class="icon wb-lock" aria-hidden="true"></i></button>
</div>
@endif
@endif
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
@php
$user = App\User::getUserDocument()->where('users.id', '=', $proces->user_id)->first();
$supporters = App\WorkflowDocumentUser::where('workflow_document_id', '=', $proces->workflow_document_id)
->where('user_type','=','S')
->where('status', '=', 'Y')
->where('added_by',$proces->assign_by)
->where('process_id',$proces->id)
->orderBy('id', 'asc')
->get();
$status = user_status($user); // helper function;
@endphp
@if(!empty($supporters->toArray()))
<div class="card">
<div class="card-block">
<div class="media">
<div class="media-body align-self-center">
<h5 class="mt-0 mb-5">
<b>{{ __('SUPPORTER USERS') }}:</b>
</h5>
<p class="user-job">
@foreach($supporters as $key => $supporter)
@php
$user = App\User::getUserDocument()->where('users.id', '=', $supporter->user_id)->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).') ';
@endphp
<b>{{ $supporter_user_name }}</b><br>
@endforeach
</p>
</div>
</div>
</div>
</div>
@endif
</div>
</li>
@else
@php
$user = App\User::getUserDocument()->where('users.id', '=', $proces->user_id)->first();
$status = user_status($user); // helper function;
@endphp
<li class="timeline-item @if($key%2==0) timeline-reverse @endif" id="{{ $key }}">
<div @if($key%2==0) class="timeline-dot bg-green-500" data-placement="left" data-toggle="tooltip" data-trigger="hover" data-original-title="2 Days ago" @else class="timeline-dot" data-placement="right" @endif></div>
<div class="timeline-content">
<div class="card">
<div class="card-block p-10">
@if($proces->user_type == 'S')
<h5 class="mt-0 mb-5">
<b>{{ __('SUPPORTER USERS') }}:</b><br>
</h5>
@endif
<div class="media">
@if($user->profile_picture && trim($user->profile_picture)!='' && file_exists(public_path('uploads/user_folder/'.$user->profile_picture)))
<div class="pr-0 pr-sm-20 align-self-center">
<div class="avatar {{ $status['class'] }}" data-toggle="tooltip" data-placement="bottom" title="{{ $status['status'] }}">
<img src='{{asset(env("UPLOADS_FOLDER") . "/" . env("USER_FOLDER") . "/" . $user->profile_picture)}}' alt="Profile Picture" >
<i class="avatar avatar-busy"></i>
</div>
</div>
@endif
<div class="media-body align-self-center">
<h5 class="mt-0 mb-5">
{{ $user->getFullName()}}
</h5>
<p class="user-job">
<button type="button" class="btn btn-warning mb-1"><i class="icon wb-user-circle" aria-hidden="true"></i> <b>{{ dataTranslation($user->role_name) }}</b></button>&nbsp;&nbsp;
@if($user->department_id !='' && $user->department_id > 0)
@php
$user_department=App\Department::where('id', $user->department_id)->first();
@endphp
@if($user_department)
<br>
<span type="button" class="btn btn-info"><i class="icon wb-briefcase" aria-hidden="true"></i> <b>{{ dataTranslation($user_department->name) }}</b></span>
@endif
@endif
</p>
</div>
</div>
<div class="row">
<div class="col-md-12 table-responsive">
<table class="table process-table">
<tbody>
<tr>
<td><label class="form-control-label"><b>{{ __('Date') }}:</b></label></td>
<td>{{ $proces->getProcessDate() }}</td>
</tr>
<tr>
<td><label class="form-control-label"><b>{{ __('Status') }}:</b></label></td>
<td>{{ __($proces->getProcessUserType()) }}</td>
</tr>
<tr>
<td><label class="form-control-label"><b>{{ __('Action') }}:</b></label></td>
<td>{{ __($proces->getProcessAction()) }}</td>
</tr>
<tr>
<td><b>{{ __('Comment') }}:</b></td>
<td><?php echo nl2br($proces->comment)?></td>
</tr>
<tr>
<td colspan="2">
@php
$reply_doce = App\WorkflowDocument::where('reply_for', $proces->workflow_document_id)->first();
@endphp
@if($proces->status=='A')
@php
$document_last_file = App\WorkflowDocumentFile::where('workflow_document_id', $proces->workflow_document_id)->orderBy('id', 'desc')->first();
@endphp
<div class="form-group col-md-12 px-1 pb-0 mb-0">
<button type="button" class="btn btn-success"><i class="icon fa fa-check-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_last_file->version }}</b></button>
<button type="button" class="btn btn-success" {{($document_last_file->isSigned()) ? '' : 'hidden'}} title="{{$document_last_file->uploader_name}}"><i class="icon wb-lock" aria-hidden="true"></i></button>
</div>
@elseif($workflow_document->workflow_type_id == 2)
@php
$document_file = App\WorkflowDocumentFile::where('workflow_document_id', $proces->workflow_document_id)->where('uploaded_by', $proces->user_id)->where('process_id',$proces->id)->orderBy('id', 'desc')->first();
@endphp
@if($document_file !== null && $document_file->version > 0)
<div class="form-group col-md-12 px-1 pb-0 mb-0">
<button type="button" class="btn btn-info"><i class="icon fa fa-plus-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_file->version }}</b></button>
<button type="button" class="btn btn-success" {{($document_file->isSigned()) ? '' : 'hidden'}} title="{{$document_file->uploader_name}}"><i class="icon wb-lock" aria-hidden="true"></i></button>
</div>
@endif
@elseif($proces->id == $workflowDocumentProcess->last()->id && !empty($reply_doce))
@php
$document_file = App\WorkflowDocumentFile::where('workflow_document_id', $reply_doce->id)->orderBy('id', 'asc')->first();
@endphp
@if($document_file !== null && $document_file->version > 0)
<div class="form-group col-md-12 px-1 pb-0 mb-0">
<button type="button" class="btn btn-info"><i class="icon fa fa-plus-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_file->version }}</b></button>
<button type="button" class="btn btn-success" {{($document_file->isSigned()) ? '' : 'hidden'}} title="{{$document_file->uploader_name}}"><i class="icon wb-lock" aria-hidden="true"></i></button>
</div>
@endif
@endif
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- -->
@if(!empty($supporters->toArray()))
<div class="card">
<div class="card-block">
<div class="media">
<div class="media-body align-self-center">
<h5 class="mt-0 mb-5">
<b>{{ __('SUPPORTER USERS') }}:</b>
</h5>
<p class="user-job">
@foreach($supporters as $key => $supporter)
@php
$user = App\User::getUserDocument()->where('users.id', '=', $supporter->user_id)->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).') ';
@endphp
<b>{{ $supporter_user_name }}</b><br>
@endforeach
</p>
</div>
</div>
</div>
</div>
@endif
</div>
</li>
@endif
@endforeach
@endif
@if(!empty($replyWorkflowDocumentProcess))
@php
$first = false;
@endphp
@foreach($replyWorkflowDocumentProcess as $key => $proces)
@if($first == false)
<li class="timeline-period">
{{ $proces->assign_date != '' ? date('d-m-Y', strtotime($proces->assign_date)) : '' }}
<div class="card">
@php
$document = App\WorkflowDocument::where('id', $proces->workflow_document_id)->first();
@endphp
<h4 class="text-primary float-center">{{ ($document) ? $document->getRegNumber() : '' }}</h4>
</div>
</li>
@php $first=true; @endphp
@endif
@php
$user = App\User::getUserDocument()->where('users.id', '=', $proces->user_id)->first();
$supporters = App\WorkflowDocumentUser::where('workflow_document_id', '=', $proces->workflow_document_id)
->where('user_type','=','S')
->where('status', '=', 'Y')
->where('added_by',$proces->assign_by)
->where('process_id',$proces->id)
->orderBy('id', 'asc')
->get();
$status = user_status($user); // helper function;
@endphp
<li class="timeline-item @if($key%2==0) timeline-reverse @endif" id="{{ $key }}">
<div @if($key%2==0) class="timeline-dot bg-green-500" data-placement="left" data-toggle="tooltip" data-trigger="hover" data-original-title="2 Days ago" @else class="timeline-dot" data-placement="right" @endif></div>
<div class="timeline-content">
<div class="card">
<div class="card-block p-10">
@if($proces->user_type == 'S')
<h5 class="mt-0 mb-5">
<b>{{ __('SUPPORTER USERS') }}:</b><br>
</h5>
@endif
<div class="media">
@if($user->profile_picture && trim($user->profile_picture)!='' && file_exists(public_path('uploads/user_folder/'.$user->profile_picture)))
<div class="pr-0 pr-sm-20 align-self-center">
<div class="avatar {{ $status['class'] }}" data-toggle="tooltip" data-placement="bottom" title="{{ $status['status'] }}">
<img src='{{asset(env("UPLOADS_FOLDER") . "/" . env("USER_FOLDER") . "/" . $user->profile_picture)}}' alt="Profile Picture" >
<i class="avatar avatar-busy"></i>
</div>
</div>
@endif
<div class="media-body align-self-center">
<h5 class="mt-0 mb-5">
{{ $user->getFullName() }}
</h5>
<p class="user-job">
<button type="button" class="btn btn-warning mb-1"><i class="icon wb-user-circle" aria-hidden="true"></i> <b>{{ dataTranslation($user->role_name) }}</b></button>&nbsp;&nbsp;
@if($user->department_id !='' && $user->department_id > 0)
@php
$user_department=App\Department::where('id', $user->department_id)->first();
@endphp
@if($user_department)
<br>
<button type="button" class="btn btn-info"><i class="icon wb-briefcase" aria-hidden="true"></i> <b>{{ dataTranslation($user_department->name) }}</b></button>
@endif
@endif
</p>
</div>
</div>
<div class="row">
<div class="col-md-12 table-responsive">
<table class="table process-table">
<tbody>
<tr>
<td><label class="form-control-label"><b>{{ __('Date') }}:</b></label></td>
<td>{{ $proces->getProcessDate() }}</td>
</tr>
<tr>
<td><label class="form-control-label"><b>{{ __('Status') }}:</b></label></td>
<td>{{ __($proces->getProcessUserType()) }}</td>
</tr>
<tr>
<td><label class="form-control-label"><b>{{ __('Action') }}:</b></label></td>
<td>{{ __($proces->getProcessAction()) }}</td>
</tr>
<tr>
<td><b>{{ __('Comment') }}:</b></td>
<td><?php echo nl2br($proces->comment)?></td>
</tr>
<tr>
<td colspan="2">
@if($proces->status=='A')
@php
$document_last_file = App\WorkflowDocumentFile::where('workflow_document_id', $proces->workflow_document_id)->orderBy('id', 'desc')->first();
@endphp
<div class="form-group col-md-12 px-1 pb-0 mb-0">
<button type="button" class="btn btn-success"><i class="icon fa fa-check-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_last_file->version }}</b></button>
<button type="button" class="btn btn-success" {{($document_last_file->isSigned()) ? '' : 'hidden'}} title="{{$document_last_file->uploader_name}}"><i class="icon wb-lock" aria-hidden="true"></i></button>
</div>
@else
@php
$document_file = App\WorkflowDocumentFile::where('workflow_document_id', $proces->workflow_document_id)->where('uploaded_by', $proces->user_id)->where('process_id',$proces->id)->orderBy('id', 'desc')->first();
@endphp
@if($document_file !== null && $document_file->version > 0)
<div class="form-group col-md-12 px-1 pb-0 mb-0">
<button type="button" class="btn btn-info"><i class="icon fa fa-plus-circle" aria-hidden="true"></i> <b>{{ __('Version') }} {{ $document_file->version }}</b></button>
<button type="button" class="btn btn-success" {{($document_file->isSigned()) ? '' : 'hidden'}} title="{{$document_file->uploader_name}}"><i class="icon wb-lock" aria-hidden="true"></i></button>
</div>
@endif
@endif
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- -->
@if(!empty($supporters->toArray()))
<div class="card">
<div class="card-block p-10">
<div class="media">
<div class="media-body align-self-center">
<h5 class="mt-0 mb-5">
<b>{{ __('SUPPORTER USERS') }}:</b>
</h5>
<p class="user-job">
@foreach($supporters as $key => $supporter)
@php
$user = App\User::getUserDocument()->where('users.id', '=', $supporter->user_id)->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).') ';
@endphp
<b>{{ $supporter_user_name }}</b><br>
@endforeach
</p>
</div>
</div>
</div>
</div>
@endif
<!-- -->
</div>
</li>
@endforeach
@endif
</ul>
<!-- TIMELINE -->
</div>
<!-- LEFT SECTION -->
<!-- RIGHT SECTION -->
@include('document-workflows.comment')
<!-- RIGHT SECTION -->
</div>
</div>
<style>
.timeline-period{
margin:0 !important;
padding: 0 !important;
}
table.process-table{
padding:0;
margin:0;
}
table.process-table td{
color: #76838f !important;
}
table.process-table td{
padding: 3px;
}
table.process-table td:nth-child(2){
color:#555 !important;
}
table.process-table td:nth-child(1){
/* min-width: 100px !important; */
/* max-width: 100px !important; */
}
</style>
<script>
var max_h = 0;
$(".timeline-item").each(function(){
h = $(this).height();
if($(this).hasClass('timeline-reverse') && h < max_h){
$(this).height(max_h);
max_h = 0;
}else{
max_h = h;
}
});
</script>