Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @using IOWebApplication.Core.Models.Attachments
- @using IOWebApplication.Core.Helper.GlobalConstants
- @model IOWebApplication.Core.Models.Applications.ApplicationDetailsViewModel
- @{
- Layout = "~/Areas/Internal/Views/Shared/_MasterLayout.cshtml";
- ViewData["Title"] = "Заявление";
- var pleaseUploadApplication = "Прикачете 'Сканирано заявление'";
- var scannedApplicationFileClickButtonText = pleaseUploadApplication;
- var returnUrl = "";
- if (!string.IsNullOrEmpty(ViewBag.ReturnUrl))
- {
- returnUrl = (string)ViewBag.ReturnUrl;
- }
- }
- <div class="row">
- @if (Model.HasAttorneyDocument && !string.IsNullOrEmpty(Model.AttorneyDocumentFileContentId))
- {
- <div class="col-lg-4 margin-bottom">
- <label style="display:block"> </label>
- <span class="form-control" readonly="readonly">№ @Model.Number / @Model.DateSent?.ToString("dd.MM.yyyy г.")</span>
- </div>
- <div class="col-lg-2 margin-bottom">
- </div>
- <div class="col-lg-3">
- <label style="display:block"> </label>
- <a href="@Url.Action("Download","File", new { area = "Internal" })/@Model.AttorneyDocumentFileContentId" style="width: 100%;" class="btn btn-info btn-flat" title="Изтегли пълномощно"><i class="fa fa-download"></i><span class="hidden-sm hidden-xs"> Изтегли пълномощно</span></a>
- </div>
- <div class="col-lg-3">
- @Html.EditorFor(x => x.AttorneyDocumentValidityDate, "DateTimeReadonly")
- </div>
- }
- else
- {
- <div class="col-lg-4 margin-bottom">
- <span class="form-control" readonly="readonly">№ @Model.Number / @Model.DateSent?.ToString("dd.MM.yyyy г.")</span>
- </div>
- }
- @if (Model.IsRejected)
- {
- <div class="col-lg-12 margin-bottom">
- <span class="form-control" readonly="readonly" style="background-color: #dd4b39; color: #fff;border-color: #d73925;"><span class="text-bold">ОТКАЗАНО</span> (@(Html.Raw(Model.ReasonForReject)))</span>
- </div>
- }
- </div>
- <div class="box box-primary">
- <div class="box-body">
- <div class="row">
- <div class="col-lg-12">
- <object data="@Model.PdfPreviewUrl" type="application/pdf" width="100%" style="height:50vh;">
- <embed src="@Model.PdfPreviewUrl" type="application/pdf" width="100%" style="height:50vh;" />
- </object>
- </div>
- </div>
- <hr />
- @if (Model.IsDocumentSigned)
- {
- <div class="row">
- <div class="col-lg-5">
- @if (string.IsNullOrEmpty(returnUrl))
- {
- <a asp-area="Internal" asp-controller="Application" asp-action="Index" class="btn btn-danger btn-flat">Назад</a>
- }
- else
- {
- <a href="@returnUrl" class="btn btn-danger btn-flat">Назад</a>
- }
- <a href="@Url.Action("DownloadFileBySourceIdAndSourceType", "File", new { area = "Internal"})?sourceId=@Model.Id&sourceType=@IOWebApplication.Core.Helper.GlobalConstants.FileSourceTypeConstant.PrintedApplication" class="btn btn-primary btn-flat" title="Отпечатай"><i class="fa fa-print"></i><span class="hidden-sm hidden-xs"> Отпечатай</span></a>
- @if (!Model.IsFromPatient)
- {
- <a href="@Url.Action("DownloadFileBySourceIdAndSourceType", "File", new { area = "Internal"})?sourceId=@Model.Id&sourceType=@IOWebApplication.Core.Helper.GlobalConstants.FileSourceTypeConstant.ScannedApplication" class="btn btn-info btn-flat" title="Ръчно подписано копие"><i class="fa fa-download"></i><span class="hidden-sm hidden-xs"> Ръчно подписано копие</span></a>
- }
- </div>
- <div class="col-lg-7 text-right">
- @if (Model.MedicalDocumentType == DocumentTypesConstant.Direction)
- {
- <a target="_blank"
- asp-area="Internal"
- asp-controller="Direction"
- asp-action="DetailsDirection"
- asp-route-id="@Model.MedicalDocumentId"
- asp-route-returnUrl="@(Url.Action("DetailsApplication", "Application", new { applicationId = Model.Id}))"
- class="btn btn-default btn-flat">
- Медицинско направление
- </a>
- }
- else if (Model.MedicalDocumentType == DocumentTypesConstant.MedicalProtocol)
- {
- <a target="_blank"
- asp-area="Internal"
- asp-controller="MedicalProtocol"
- asp-action="DetailsMedicalProtocol"
- asp-route-id="@Model.MedicalDocumentId"
- asp-route-returnUrl="@(Url.Action("DetailsApplication", "Application", new { applicationId = Model.Id}))"
- class="btn btn-default btn-flat">
- Медицински протокол
- </a>
- }
- @if (User.IsInRole(RolesConstant.RhiOfficial) && !Model.IsRejected && Model.CommissionId == null)
- {
- <button type="button" id="RejectApplicationButton" onclick="RejectApplicationWarning(); return false;" class="btn btn-danger btn-flat">Откажи заявление</button>
- }
- @if (User.IsInRole(RolesConstant.RhiOfficial) && !Model.IsRejected && Model.IsFromPatient && !Model.IsConfirmed)
- {
- <button type="button" id="ConfirmApplicationButton" onclick="ConfirmApplicationWarning(); return false;" class="btn btn-success btn-flat">Потвърди заявление</button>
- }
- </div>
- </div>
- }
- else
- {
- @if (User.IsInRole(RolesConstant.RhiOfficial))
- {
- <form id="detailsApplicationForm" asp-area="Internal" asp-controller="Application" asp-action="DetailsApplication" method="post" enctype="multipart/form-data">
- @Html.HiddenFor(x => x.Id)
- @Html.HiddenFor(x => x.IsDocumentSigned)
- @Html.HiddenFor(x => x.MedicalDocumentId)
- @Html.HiddenFor(x => x.MedicalDocumentType)
- @Html.HiddenFor(x => x.PdfPreviewUrl)
- @Html.HiddenFor(x => x.IsFromPatient)
- @Html.HiddenFor(x => x.IsRejected)
- @Html.HiddenFor(x => x.IsConfirmed)
- @Html.HiddenFor(x => x.ReasonForReject)
- @Html.HiddenFor(x => x.AttorneyDocumentFileContentId)
- @Html.HiddenFor(x => x.AttorneyDocumentValidityDate)
- @Html.HiddenFor(x => x.HasAttorneyDocument)
- <div class="row">
- <div class="col-lg-6">
- <div class="form-group">
- <label asp-for="@Model.ScannedApplicationFile" class="control-label"></label>
- <input asp-for="@Model.ScannedApplicationFile" style="display:none" />
- <div>
- <div class="btn-group" role="group">
- <button type="button" id="ScannedApplicationFileClickButton" class="btn btn-info btn-flat" onclick="ScannedApplicationFileClick();"><i class="fa fa-upload"></i></button>
- <button type="button" id="ScannedApplicationFileClickButtonText" class="btn btn-flat" onclick="ScannedApplicationFileClick();">@Html.Raw(scannedApplicationFileClickButtonText)</button>
- </div>
- </div>
- <span asp-validation-for="@Model.ScannedApplicationFile" class="text-danger"></span>
- </div>
- </div>
- </div>
- </form>
- }
- <div class="row">
- <div class="col-md-12">
- @if (string.IsNullOrEmpty(returnUrl))
- {
- <a asp-area="Internal" asp-controller="Application" asp-action="Index" class="btn btn-danger btn-flat">Назад</a>
- }
- else
- {
- <a href="@returnUrl" class="btn btn-danger btn-flat">Назад</a>
- }
- @if (User.IsInRole(RolesConstant.RhiOfficial))
- {
- <button id="detailsApplicationFormSubmitButton" type="button" class="btn btn-flat btn-success">Маркирай като подписан</button>
- }
- <a href="@Url.Action("DownloadFileBySourceIdAndSourceType", "File", new { area = "Internal"})?sourceId=@Model.Id&sourceType=@IOWebApplication.Core.Helper.GlobalConstants.FileSourceTypeConstant.PrintedApplication" class="btn btn-primary btn-flat" title="Отпечатай"><i class="fa fa-print"></i><span class="hidden-sm hidden-xs"> Отпечатай</span></a>
- </div>
- </div>
- }
- </div>
- </div>
- @if (Model.Id > 0)
- {
- @await Html.PartialAsync("_AttachedDocumentsTablePartial", new AttachedDocumentsTableViewModel
- {
- MedicalDocumentId = Model.MedicalDocumentId,
- MedicalDocumentType = Model.MedicalDocumentType,
- HideDeleteButton = true,
- HideAddNewDocumentButton = true
- })
- }
- @section scripts{
- <script id="rejectApplicationTemplate" type="text/x-handlebars-template">
- <div class="form-group">
- <div class="row">
- <div class="col-md-12">
- <label for="reasonForRejection" class="control-label">Мотиви за отказ:</label>
- <div>
- <textarea id="reasonForRejection" rows="3" class="form-control"></textarea>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <span id="reasonForRejectionValidation" class="text-danger" data-valmsg-replace="true"></span>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <br />
- <button type="button" onclick="RejectApplication(); return false;" class="btn btn-primary">@Html.Raw("Откажи заявление")</button>
- <button type="button" class="btn btn-danger dt-reload" data-dismiss="modal">@Html.Raw("Назад")</button>
- </div>
- </div>
- </div>
- </script>
- <script>
- function ValidateRejectApplication(reasonForRejection) {
- $('#reasonForRejectionValidation').text('');
- if (reasonForRejection === '') {
- $('#reasonForRejectionValidation').text('Полето е задължително.');
- return false;
- }
- return true;
- }
- function RejectApplication() {
- var reasonForRejection = $('#reasonForRejection').val().trim();
- var isValid = ValidateRejectApplication(reasonForRejection);
- if (isValid) {
- $.post("@Url.Action("RejectApplication", "Application", new { area = "Internal"})", { applicationId: '@Model.Id', reasonForReject: reasonForRejection })
- .done(function (result) {
- HideModalDialog();
- if (result === 'ok') {
- swal({
- title: '@(Html.Raw(MessageConstant.Values.SaveOK))',
- text: 'Настоящото заявление беше отказано успешно!',
- icon: "success"
- });
- setTimeout(function () {
- window.location.href = '@Url.Action("DetailsApplication", "Application", new { area = "Internal", applicationId = Model.Id})';
- }, 2000);
- }
- else {
- HideModalDialog();
- swal({
- title: '@(Html.Raw(MessageConstant.Values.SaveFailed))',
- text: 'Настъпи грешка при отказването на настоящото заявление!',
- icon: "error",
- dangerMode: true
- });
- }
- })
- .fail(function (error) {
- HideModalDialog();
- swal({
- title: '@(Html.Raw(MessageConstant.Values.SaveFailed))',
- text: 'Настъпи грешка при отказването на настоящото заявление!',
- icon: "error",
- dangerMode: true
- });
- })
- .always();
- }
- }
- function RejectApplicationWarning() {
- swal({
- title: "Сигурни ли сте?",
- text: "Настоящото Заявление ще бъде ОТКАЗАНО!",
- icon: "warning",
- dangerMode: true,
- buttons: ["Назад", "Да"],
- })
- .then((result) => {
- if (result) {
- ShowModalDialog("Отказ на Заявление!", TemplateToHtml('#rejectApplicationTemplate'));
- }
- });
- }
- </script>
- <script>
- function ConfirmApplication() {
- $.post("@Url.Action("ConfirmApplication", "Application", new { area = "Internal"})", { applicationId: '@Model.Id' })
- .done(function (result) {
- if (result === 'ok') {
- swal({
- title: '@(Html.Raw(MessageConstant.Values.SaveOK))',
- text: 'Настоящото заявление беше потвърдено успешно!',
- icon: "success"
- });
- setTimeout(function () {
- window.location.href = '@Url.Action("DetailsApplication", "Application", new { area = "Internal", applicationId = Model.Id})';
- }, 2000);
- }
- else {
- swal({
- title: '@(Html.Raw(MessageConstant.Values.SaveFailed))',
- text: 'Настъпи грешка при потвърждаването на настоящото заявление!',
- icon: "error",
- dangerMode: true
- });
- }
- })
- .fail(function (error) {
- swal({
- title: '@(Html.Raw(MessageConstant.Values.SaveFailed))',
- text: 'Настъпи грешка при потвърждаването на настоящото заявление!',
- icon: "error",
- dangerMode: true
- });
- })
- .always();
- }
- function ConfirmApplicationWarning() {
- swal({
- title: "Сигурни ли сте?",
- text: "Настоящото Заявление ще бъде ПОТВЪРДЕНО!",
- icon: "warning",
- dangerMode: true,
- buttons: ["Назад", "Да"],
- })
- .then((result) => {
- if (result) {
- ConfirmApplication();
- }
- });
- }
- function ScannedApplicationFileClick() {
- $('#ScannedApplicationFile').trigger('click');
- }
- function ValidateAndSubmitDetailsApplicationForm() {
- if ($('#ScannedApplicationFileClickButtonText').text() === "@Html.Raw(pleaseUploadApplication)") {
- swal({
- title: "Моля прикачете файл!",
- text: "Към настоящото заявление няма приложено 'Сканирано заявление (Ръчно подписано)'!",
- icon: "error",
- dangerMode: true
- });
- }
- else {
- $('#detailsApplicationForm').submit();
- }
- }
- $(document).on('click', '#detailsApplicationFormSubmitButton', function () {
- ValidateAndSubmitDetailsApplicationForm();
- });
- $(document).on('change', '#ScannedApplicationFile', function () {
- if ($('#ScannedApplicationFile').val() !== "") {
- var fileNameArray = $('#ScannedApplicationFile').val().split(/[\\\/]+/);
- $('#ScannedApplicationFileClickButtonText').text(fileNameArray[fileNameArray.length - 1]);
- } else {
- $('#ScannedApplicationFileClickButtonText').text('@pleaseUploadApplication');
- }
- });
- </script>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement