Raffales-LMS/resources/views/crud/generated/offerapplications/create.blade.php
2024-04-16 15:43:24 +05:45

232 lines
11 KiB
PHP

@extends('backend.template')
@section('content')
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Add Offer Application</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">Add Offer Application</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<form action="{{ route('offerapplications.store') }}" id="storeCustomForm" method="POST">
@csrf
<div class="row">
<div class="col-lg-9 col-md-8">
<div class="card">
<div class="card-body">
<div class="col-lg-12">
{{ createCustomSelect('tbl_students', 'name', 'student_id', '', 'Students', 'students_id', 'form-control select2', 'status<>-1') }}
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Offer Application</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-6">
{{ createCustomSelect('tbl_programs', 'title', 'program_id', '', 'Programs', 'programs_id', 'form-control select2', 'status<>-1') }}
</div>
<div class="col-lg-6">{{ createText('title', 'title', 'Title') }}</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">
Advice
</h5>
</div>
<div class="card-body">
<div class="col-lg-12">{{ createTextArea('advice', 'advic', '') }}</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Description</h5>
</div>
<div class="card-body">
<div class="col-lg-12 pb-2">
{{ createTextarea('description', 'description', '') }}
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Remarks</h5>
</div>
<div class="card-body">
<div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', 'remarks ', '') }}</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">
Mandatory Documents
</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-12">
@foreach ($mandatoryDocuments as $document)
<div class="form-check">
<input type="checkbox" class="form-check-input requireddocuments-checkbox"
name="required_documents[]" value="{{ $document->requireddocument_id }}"
checked>
<label class="form-check-label">{{ $document->title }}</label>
</div>
@endforeach
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Additional Documents</h5>
</div>
<div class="card-body">
<div class="col-lg-12">
<p class="text-muted mb-2">
<a href="#" class="float-end text-decoration-underline" id="addNewDocument">Add New</a>
</p>
<div id="additionalDocumentsContainer">
<div class="document-input" style="display: none;">
<input type="text" name="additional_documents[]" class="form-control"
placeholder="Document Name">
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Applications Status</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-12">
{{ createDate('application_date', 'Application Date', '', date('Y-m-d')) }}
<!-- {{ createText('application_date', 'application_date', 'Application Date') }} -->
</div>
<div class="col-lg-12">
{{ createText('application_fee', 'application_fee', 'Application Fee') }}
</div>
<div class="col-lg-12 pb-3">
{{ createDate('applicationfee_deadline', 'application Fee_deadline', '', date('Y-m-d')) }}
</div>
<div class="col-lg-12">
<label>Application Fee Paid</label>
<div>
<input type="radio" id="applicationfee_paid_yes" name="applicationfee_paid" value="1">
<label for="applicationfee_paid_yes">Yes</label>
</div>
<div>
<input type="radio" id="applicationfee_paid_no" name="applicationfee_paid" value="0">
<label for="applicationfee_paid_no">No</label>
</div>
</div>
<div class="col-lg-12">
{{ createText('applicationfee_paymentdate', 'applicationfee_paymentdate', 'Application Fee Payment Date') }}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Offer Status</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-12">{{ createText('offer_status', 'offer_status', 'Offer Status') }}
</div>
<div class="col-lg-12">{{ createText('offer_letter', 'offer_letter', 'Offer Letter') }}
</div>
<div class="col-lg-12 pb-3">
{{ createDate('offerletter_date', 'Offer Letter Date', '', date('Y-m-d')) }}
<!-- {{ createText('offerletter_date', 'offerletter_date', 'Offer Letter Date') }} -->
</div>
<div class="col-lg-12">
{{ createText('offered_conditions', 'offered_conditions', 'Offered Conditions') }}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-footer">
<div class="col-md-12"><?php createButton('btn-primary btn-store', '', 'Submit'); ?>
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('offerapplications.index')); ?>
</div>
</div>
</div>
</div>
</div>
</form>
<script>
document.addEventListener('DOMContentLoaded', function() {
const addNewDocumentButton = document.getElementById('addNewDocument');
const additionalDocumentsContainer = document.getElementById('additionalDocumentsContainer');
const additionalDocumentsArray = document.getElementById('additionalDocumentsArray');
let inputValuesArray = [];
let count = 0; // Track the count of clicks
addNewDocumentButton.addEventListener('click', function(e) {
e.preventDefault();
if (count === 0) {
// Show the first input field
additionalDocumentsContainer.querySelector('.document-input:first-child').style.display = 'block';
count += 1;
} else {
const lastInput = additionalDocumentsContainer.querySelector(
'.document-input:last-child input[type="text"]');
if (!lastInput || lastInput.value.trim() !== '') {
const newDocumentInput = document.createElement('div');
newDocumentInput.className = 'document-input';
newDocumentInput.innerHTML =
`<input type="text" name="additional_documents[]" class="form-control" placeholder="Document Name">`;
additionalDocumentsContainer.appendChild(newDocumentInput);
inputValuesArray.push(lastInput.value);
} else {
inputValuesArray.push('');
}
}
additionalDocumentsArray.value = inputValuesArray.join(', ');
});
document.querySelector('form').addEventListener('submit', function() {
const lastInput = additionalDocumentsContainer.querySelector(
'.document-input:last-child input[type="text"]');
if (lastInput) {
inputValuesArray.push(lastInput.value);
additionalDocumentsArray.value = inputValuesArray.join(', ');
}
});
});
</script>
@endsection