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

310 lines
15 KiB
PHP

@extends('layouts.master')
@section('pageTitle', __('Document Workflow'))
@section('content')
@include('includes.form_style')
<div class="page-header">
<h1 class="page-title">{{ __('Assign 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>
<style type="text/css">
.files input {
outline: 2px dashed #92b0b3;
padding: 200px 0px 85px 50%;
text-align: center !important;
margin: 0;
width: 100% !important;
}
.files input:focus{
outline: 2px dashed #92b0b3;
}
.files{ position:relative}
.color input{ background-color:#f1f1f1;}
.files:before {
position: absolute;
bottom: 20px;
left: 0; pointer-events: none;
width: 100%;
right: 0;
height: 150px;
content: " {{ __('Click Or Drop Files To Upload.') }} ";
display: block;
margin: 0 auto;
color: #76838f;
text-transform: capitalize;
text-align: center;
background: white;
font-size: 24px;
}
</style>
<script type="text/javascript">
<!--
$(function(){
$("#add-form").validationEngine('attach',{scroll:false});
$("#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'
}).datepicker('update', new Date());
});
function ValidateFileUpload(file_id, msg) {
var fuData = document.getElementById(file_id);
if (fuData.files && fuData.files[0]) {
var flag=true;
var html_con='';
$.each(fuData.files, function (key, val) {
var Extension = val.name.substring(val.name.lastIndexOf('.') + 1).toLowerCase();
if (Extension == "pdf" || Extension == "png" || Extension == "jpeg" || Extension == "jpg")
{
html_con +='<div class="col-md-6 my-2 px-2"><div class="bg-light p-2">'+val.name+'</div></div>';
}
else
{
flag=false;
}
});
if(flag==false){
alert(msg+" only allows file types of PNG, JPG, JPEG and PDF. ");
document.getElementById(file_id+"_priview").innerHTML = ''
document.getElementById(file_id).value = '';
}
else
{
document.getElementById(file_id+"_priview").innerHTML = html_con;
}
}
}
//-->
</script>
<div class="page-content">
<div class="panel">
<div class="panel-body container-fluid">
<div class="row row-lg">
<div class="col-md-12">
<div class="example-wrap">
<div class="example">
@if($errors->any())
<div class="alert alert-danger">
@foreach($errors->all() as $error)
<p>{{ $error }}</p>
@endforeach
</div>
@endif
<form method="post" action="{{ route('document_assign_store', 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" for="workflow_type_id">{{ __('Workflow Type') }}</label>
<select class="form-control validate[required]" name = "" id = "workflow_type_id" disabled >
@if($workflow_types)
@foreach($workflow_types as $workflow_type)
<option value = "{{ $workflow_type->id }}" {{ $workflow_document->workflow_type_id && $workflow_document->workflow_type_id == $workflow_type->id ? 'selected' : '' }} >{{ dataTranslation($workflow_type->name) }}</option>
@endforeach
@endif
</select>
</div>
<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 = "" id = "due_date" data-plugin="datepicker" autocomplete="off" readonly disabled value="{{ old('due_date') ? old('due_date') : $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 = "" id = "priority_id" disabled>
@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>
</div>
<div class="row">
<div class="form-group col-md-6">
<label class="form-control-label" for="registration_number">{{ __('Registration Number') }}</label>
<input type="text" class="form-control" name = "" id = "registration_number" autocomplete="off" readonly value="{{ $workflow_document->registration_number }}" disabled>
</div>
<div class="form-group col-md-6">
<label class="form-control-label" for="registration_date">{{ __('Registration 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 = "" id = "registration_date" autocomplete="off" readonly value="{{ old('registration_date') ? old('registration_date') : $workflow_document->registration_date }}" data-plugin="datepicker" disabled>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-6">
<label class="form-control-label" for="delivery_type_id">{{ __('Type Of Delivery') }}</label>
<select class="form-control validate[required]" name = "" id = "delivery_type_id" disabled>
@if($delivery_types)
@foreach($delivery_types as $delivery_type)
<option value = "{{ $delivery_type->id }}" {{ $workflow_document->delivery_type_id && $workflow_document->delivery_type_id==$delivery_type->id ?'selected':'' }} >{{ dataTranslation($delivery_type->name) }}</option>
@endforeach
@endif
</select>
</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 = "" id = "document_type_id" disabled>
@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" for="contact_id">{{ __('Choose Sender') }}</label>
<div class="select2-primary">
<select class="form-control validate[required]" multiple="multiple" data-plugin="select2" style="width:100%" name="" id="contact_id" disabled>
@if($senders)
@foreach($senders as $sender)
@php
$contact =App\WorkflowDocumentSender::where('contact_id', $sender->id)->where('workflow_document_id', $workflow_document->id)->first();
@endphp
<option value = "{{ $sender->id }}" {{ $contact && $contact->contact_id == $sender->id ?'selected':'' }} >{{ $sender->organization_name }}</option>
@endforeach
@endif
</select>
</div>
</div>
<div class="form-group col-md-4">
<label class="form-control-label" for="sender_letter_number">{{ __('Sender Letter Number') }}</label>
<input type="text" class="form-control validate[required]" name = "" id = "sender_letter_number" autocomplete="off" value="{{ old('sender_letter_number') ? old('sender_letter_number') : $workflow_document->sender_letter_number }}" disabled/>
</div>
<div class="form-group col-md-4">
<label class="form-control-label" for="sender_letter_date">{{ __('Sender Letter 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 = "" id = "sender_letter_date" data-plugin="datepicker" autocomplete="off" readonly disabled value="{{ old('sender_letter_date') ? old('sender_letter_date') : $workflow_document->sender_letter_date }}">
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-6">
<label class="form-control-label" for="topic">{{ __('Topic') }}</label>
<textarea class="form-control validate[required]" name = "" id = "topic" maxlength="{{ $setting->topic_text_limit }}" disabled>{{ old('topic') ? old('topic') : $workflow_document->topic }}</textarea>
</div>
<div class="form-group col-md-6">
<label class="form-control-label" for="additional_notes">{{ __('Additional Notes') }}</label>
<textarea class="form-control" name = "" id = "additional_notes" maxlength="{{ $setting->additional_notes_text_limit }}" disabled>{{ old('additional_notes') ? old('additional_notes') : $workflow_document->additional_notes }}</textarea>
</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" multiple data-plugin="select2" style="width:100%" name="related_documents[]" id="related_documents">
@if($documents)
@foreach($documents->where('registration_number', '!=', '')->where('is_deleted', 0) 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" style="width:100%" name="reviewers" id="reviewers">
<option value = "" >Assign As Reviewer</option>
@if($users)
@foreach($users->where('department_id', '0') as $user)
<option value = "{{ 'uid-'.$user->id }}" {{ old('reviewers') && ('uid-'.$user->id==old('reviewers')) ?'selected':'' }} >{{ $user->first_name }} {{ $user->last_name }} - {{ dataTranslation($user->role_name) }}</option>
@endforeach
@endif
@if($departments)
@foreach($departments as $department)
<option style="" value = "{{ 'did-'.$department->id }}" {{ old('reviewers') && ('did-'.$department->id==old('reviewers')) ?'selected':'' }} >{{ $department->name }} - ({{ __('Department') }})</option>
@foreach($users->where('department_id', $department->id) as $user)
<option value = "{{ 'uid-'.$user->id }}" {{ old('reviewers') && ('uid-'.$user->id==old('reviewers')) ?'selected':'' }} >{{ $user->first_name }} {{ $user->last_name }} - {{ dataTranslation($user->role_name) }} - {{ $department->name }}</option>
@endforeach
@endforeach
@endif
</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" style="width:100%" name="supporters[]" id="supporters">
@if($users)
@foreach($users->where('department_id', '0') as $user)
@php
$supporter =App\WorkflowDocumentUser::where('user_id', $user->id)->where('workflow_document_id', $workflow_document->id)->where('status', 'Y')->first();
@endphp
<option value = "{{ $user->id }}" {{ $supporter && $supporter->user_id == $user->id ?'selected':'' }} >{{ $user->first_name }} {{ $user->last_name }} - {{ dataTranslation($user->role_name) }}</option>
@endforeach
@endif
@if($departments)
@foreach($departments as $department)
<optgroup label="{{ $department->name }}">
@foreach($users->where('department_id', $department->id) as $user)
@php
$supporter =App\WorkflowDocumentUser::where('user_id', $user->id)->where('workflow_document_id', $workflow_document->id)->where('status', 'Y')->first();
@endphp
<option value = "{{ $user->id }}" {{ $supporter && $supporter->user_id == $user->id ?'selected':'' }} >{{ $user->first_name }} {{ $user->last_name }} - {{ dataTranslation($user->role_name) }}</option>
@endforeach
</optgroup>
@endforeach
@endif
</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="form-group">
<button type="submit" class="btn btn-success"><i class="icon wb-check" aria-hidden="true"></i> {{ __('SAVE') }}</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@include('includes.form_script')
@endsection