270 lines
13 KiB
PHP
270 lines
13 KiB
PHP
@extends('layouts.master')
|
|
@section('pageTitle', __('Edit Document Workflow'))
|
|
@section('content')
|
|
@include('includes.form_style')
|
|
|
|
<div class="page-header">
|
|
<h1 class="page-title">{{ __('Edit 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','Incoming') }}">{{ __('Document') }}</a></li>
|
|
<li class="breadcrumb-item active">{{ __('Document Workflow') }}</li>
|
|
</ol>
|
|
<div class="page-header-actions">
|
|
<a class="btn btn-dark" href="{{ route('documents','Incoming') }}">
|
|
<i class="icon wb-arrow-left" aria-hidden="true"></i>
|
|
<span class="hidden-sm-down">{{ __('Back To Document') }}</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
$(function(){
|
|
$("#add-form").validationEngine('attach',{scroll:false});
|
|
$("#status").change(function(){
|
|
if($(this).val()=='Delegate'){
|
|
$("#reviewers").addClass('validate[required]');
|
|
}
|
|
else{
|
|
if($("#reviewers").hasClass('validate[required]'))
|
|
{
|
|
$("#reviewers").removeClass('validate[required]');
|
|
}
|
|
}
|
|
});
|
|
$("#workflow_type_id").change(function(){
|
|
if($(this).val()=='2'){
|
|
$(".hide-on-demand").hide()
|
|
}
|
|
else{
|
|
$(".hide-on-demand").show()
|
|
}
|
|
});
|
|
$(".datepicker").datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd-mm-yyyy'
|
|
});
|
|
$('#reviewers').change(function(){
|
|
getSupportersOption($(this).val());
|
|
});
|
|
getSupportersOption($('#reviewers').find('option').first().val());
|
|
});
|
|
|
|
function getSupportersOption(optVal){
|
|
$('#supporters').html($('#supporters_demo').html());
|
|
$("#supporters option[value='"+optVal+"']").remove();
|
|
}
|
|
</script>
|
|
<div class="page-content">
|
|
<div class="row">
|
|
<!-- LEFT SECTION -->
|
|
<div class="col-xxl-8 col-xl-8 col-lg-12">
|
|
<div class="card">
|
|
<div class="card-block">
|
|
@if($errors->any())
|
|
<div class="alert alert-danger">
|
|
@foreach($errors->all() as $error)
|
|
<p>{{ $error }}</p>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
<form method="post" action="{{ route('update_document', base64_encode($workflow_document->id)) }}" id="add-form" autocomplete="off" enctype="multipart/form-data">
|
|
@csrf
|
|
<div class="row">
|
|
<div class="form-group col-md-4">
|
|
<label class="form-control-label">{{ __('Workflow Type') }}</label>
|
|
@php
|
|
$workflow_type = App\WorkflowType::where('id', $workflow_document->workflow_type_id)->first();
|
|
@endphp
|
|
<div class="form-control bg-light cursor-not-allowed">{{ dataTranslation($workflow_type->name) ? dataTranslation($workflow_type->name) : ''}}</div>
|
|
</div>
|
|
@if(!in_array($document_user->role_id, ['1', '2']))
|
|
<div class="form-group col-md-4">
|
|
<label class="form-control-label" for="">{{ __('Due Date') }}</label>
|
|
<div class="input-group">
|
|
<span class="input-group-addon">
|
|
<i class="icon wb-calendar" aria-hidden="true"></i>
|
|
</span>
|
|
<div class="form-control bg-light cursor-not-allowed">{{ $workflow_document->due_date != '' ? date('d-m-Y', strtotime($workflow_document->due_date)) : ''}}</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="form-control-label">{{ __('Priority') }}</label>
|
|
@php
|
|
$priority = App\Priority::where('id', $workflow_document->priority_id)->first();
|
|
@endphp
|
|
<div class="form-control bg-light cursor-not-allowed">{{ dataTranslation($priority->name) ? dataTranslation($priority->name) : ''}}</div>
|
|
</div>
|
|
@else
|
|
<div class="form-group col-md-4">
|
|
<label class="form-control-label" for="due_date">{{ __('Due Date') }}</label>
|
|
<div class="input-group">
|
|
<span class="input-group-addon">
|
|
<i class="icon wb-calendar" aria-hidden="true"></i>
|
|
</span>
|
|
<input type="text" class="form-control datepicker validate[required]" name = "due_date" id = "due_date" data-plugin="datepicker" autocomplete="off" readonly value="{{ old('due_date') ? old('due_date') : ($workflow_document->due_date != '' ? date('d-m-Y', strtotime($workflow_document->due_date)) : '') }}">
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="form-control-label" for="priority_id">{{ __('Priority') }}</label>
|
|
<select class="form-control validate[required]" name = "priority_id" id = "priority_id">
|
|
@if($priorities)
|
|
@foreach($priorities as $priority)
|
|
<option value = "{{ $priority->id }}" {{ $workflow_document->priority_id && $workflow_document->priority_id == $priority->id ?'selected':'' }} >{{ dataTranslation($priority->name) }}</option>
|
|
@endforeach
|
|
@endif
|
|
</select>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-md-6">
|
|
<label class="form-control-label">{{ __('Registration Number') }}</label>
|
|
<div class="form-control bg-light cursor-not-allowed">{{ $workflow_document->registration_number }}</div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label class="form-control-label">{{ __('Registration Date') }}</label>
|
|
<div class="input-group">
|
|
<span class="input-group-addon">
|
|
<i class="icon wb-calendar" aria-hidden="true"></i>
|
|
</span>
|
|
<div class="form-control bg-light cursor-not-allowed">{{ $workflow_document->registration_date != '' ? date('d-m-Y', strtotime($workflow_document->registration_date)) : ''}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-md-6">
|
|
<label class="form-control-label">{{ __('Type Of Delivery') }}</label>
|
|
@php
|
|
$delivery_type = App\DeliveryType::where('id', $workflow_document->delivery_type_id)->first();
|
|
@endphp
|
|
<div class="form-control bg-light cursor-not-allowed">{{ dataTranslation($delivery_type->name) ? dataTranslation($delivery_type->name) : '' }}</div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label class="form-control-label" for="document_type_id">{{ __('Type Of Document') }}</label>
|
|
<div class="input-group">
|
|
<select class="form-control validate[required]" name = "document_type_id" id = "document_type_id">
|
|
@if($document_types)
|
|
@foreach($document_types as $document_type)
|
|
<option value = "{{ $document_type->id }}" {{ $workflow_document->document_type_id && $workflow_document->document_type_id==$document_type->id ?'selected':'' }} >{{ dataTranslation($document_type->name) }}</option>
|
|
@endforeach
|
|
@endif
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row hide-on-demand" style="{{ $workflow_document->workflow_type_id==2 ? 'display:none' : '' }}">
|
|
<div class="form-group col-md-4">
|
|
<label class="form-control-label">{{ __('Choose Sender') }}</label>
|
|
<div id="" class="form-control bg-light cursor-not-allowed h-auto">
|
|
@if($senders)
|
|
@foreach($senders as $sender)
|
|
@php
|
|
$contact =App\WorkflowDocumentSender::where('contact_id', $sender->id)->where('workflow_document_id', $workflow_document->id)->first();
|
|
@endphp
|
|
@if($contact && $contact->contact_id == $sender->id)
|
|
{{ $sender->organization_name }}<br>
|
|
@endif
|
|
@endforeach
|
|
@endif
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="form-control-label">{{ __('Sender Letter Number') }}</label>
|
|
<div class="form-control bg-light cursor-not-allowed">{{ $workflow_document->sender_letter_number}}</div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="form-control-label">{{ __('Sender Letter Date') }}</label>
|
|
<div class="input-group">
|
|
<span class="input-group-addon">
|
|
<i class="icon wb-calendar" aria-hidden="true"></i>
|
|
</span>
|
|
<div class="form-control bg-light cursor-not-allowed">{{ $workflow_document->sender_letter_date != '' ? date('d-m-Y', strtotime($workflow_document->sender_letter_date)) : '' }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-md-6">
|
|
<label class="form-control-label" for="">{{ __('Topic') }}</label>
|
|
<div class="form-control bg-light cursor-not-allowed">{{ $workflow_document->topic}}</div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label class="form-control-label" for="">{{ __('Additional Notes') }}</label>
|
|
<div class="form-control bg-light cursor-not-allowed">{{ $workflow_document->additional_notes}}</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-md-12">
|
|
<label class="form-control-label" for="related_documents">{{ __('Related Document') }}</label>
|
|
<div class="select2-primary">
|
|
<select class="form-control " data-plugin="select2" style="width:100%"multiple name="related_documents[]" id="related_documents" style="width:100%">
|
|
@if(isset($documents))
|
|
@foreach($documents->where('id', '<>', $workflow_document->id)->where('registration_number', '!=', '') as $document)
|
|
<option value = "{{ $document->id }}" data-value = "{{ $document->registration_number }}" {{ $workflow_document->related_documents!='' && in_array($document->id, json_decode($workflow_document->related_documents, true)) ?'selected':'' }} >{{ $document->registration_number }}</option>
|
|
@endforeach
|
|
@endif
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-md-6">
|
|
<label class="form-control-label" for="reviewers">{{ __('Assign As Reviewer') }}</label>
|
|
<div class="select2-primary">
|
|
<select class="form-control validate[required]" data-plugin="select2" name="reviewers" id="reviewers" style="width:100%">
|
|
@include('document-workflows.edit_document_reviewer_options')
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label class="form-control-label" for="supporters">{{ __('Assign As Supporter') }}</label>
|
|
<div class="select2-primary">
|
|
<select class="form-control" multiple data-plugin="select2" name="supporters[]" id="supporters" style="width:100%">
|
|
@include('document-workflows.edit_document_supporter_options')
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-md-12">
|
|
<label class="form-control-label" for="comment">{{ __('Comments') }}</label>
|
|
<textarea class="form-control" name = "comment" id = "comment" maxlength="{{ $setting->comment_text_limit }}">{{ old('comment') ? old('comment') : '' }}</textarea>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-md-12">
|
|
<label class="form-control-label" for="inputBasicFirstName">{{ __('Set Status') }}</label>
|
|
<select class="form-control validate[required]" name = "status" id = "status">
|
|
<option value="Save & Close" {{ $workflow_document->status && $workflow_document->status=='Save & Close' ?'selected':'' }}> {{ __('Save & Close') }}</option>
|
|
@if($document_user && $document_user->role_id != 5 )
|
|
<option value="Delegate" {{ $workflow_document->status && $workflow_document->status=='Delegate' ?'selected':'' }}> {{ __('Delegate') }}</option>
|
|
@endif
|
|
<option value="Cancel" {{ $workflow_document->status && $workflow_document->status=='Cancel' ?'selected':'' }}>{{ __('Cancel') }}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<button type="submit" class="btn btn-success"><i class="icon wb-check" aria-hidden="true"></i> {{ __('UPDATE') }}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<select class="d-none" id="supporters_demo" >
|
|
@include('document-workflows.edit_document_supporter_options')
|
|
</select>
|
|
</div>
|
|
<!-- LEFT SECTION -->
|
|
|
|
<!-- RIGHT SECTION -->
|
|
@include('document-workflows.view_reply_right_section')
|
|
<!-- RIGHT SECTION -->
|
|
</div>
|
|
</div>
|
|
@include('includes.form_script')
|
|
@endsection
|