File: /www/wwwroot/erp.nhatnamsst.com/storage/framework/views/408a31093215b562cbb8031ed8959c86.php
<div class="row">
<div class="col-md-3 col-12">
<div class="mb-3">
<span><?php echo app('translator')->get('Mã yêu cầu báo giá'); ?>: <?php echo e($quoteRequest->code ?? '-'); ?></span>
</div>
</div>
<div class="col-md-3 col-12">
<div class="mb-3">
<span><?php echo app('translator')->get('Nhân viên Sales'); ?>:
<?php echo e(($quoteRequest->sale->code ?? '') . ($quoteRequest->sale && $quoteRequest->sale->code ? ' - ' : '') . ($quoteRequest->sale->fullname ?? '-')); ?></span>
</div>
</div>
<div class="col-md-3 col-12">
<div class="mb-3">
<span><?php echo app('translator')->get('Hãng'); ?>: <?php echo e($quoteRequest->brand->name ?? '-'); ?></span>
</div>
</div>
<div class="col-md-3 col-12">
<div class="mb-3">
<span><?php echo app('translator')->get('Tên khách hàng'); ?>: <?php echo e($quoteRequest->customer->name ?? '-'); ?></span>
</div>
</div>
<div class="col-md-3 col-12">
<div class="mb-3">
<span><?php echo app('translator')->get('Trạng thái'); ?>: <?php echo e($quoteRequest->status ? $quoteRequest->status->description() : '-'); ?></span>
</div>
</div>
<div class="col-md-3 col-12">
<div class="mb-3">
<span><?php echo app('translator')->get('Ngày yêu cầu'); ?>:
<?php echo e($quoteRequest->request_date ? $quoteRequest->request_date->format('d/m/Y') : '-'); ?></span>
</div>
</div>
<?php
$currentAdmin = get_auth_admin();
$isSaleOrLeaderSale = $currentAdmin ? $currentAdmin->isSaleOrLeaderSale() : false;
$isInterOrLeaderInter = $currentAdmin ? $currentAdmin->isInterOrLeaderInter() : false;
$isAdmin = $currentAdmin ? $currentAdmin->isAdmin() : false;
$isLeaderSale = $currentAdmin && $currentAdmin->role === \Domains\Core\Enums\AdminRole::LEADER_SALE;
$hasNoInter = $quoteRequest->inters->isEmpty();
$canAssignInter = ($isAdmin || $isLeaderSale) && $hasNoInter;
?>
<?php if(!$isSaleOrLeaderSale && !$isInterOrLeaderInter): ?>
<div class="col-md-3 col-12">
<div class="mb-3">
<?php if($quoteRequest->inters->count() > 0): ?>
<span><?php echo app('translator')->get('Phân Inter'); ?>:
<?php echo e($quoteRequest->inters->map(function ($inter) {return ($inter->code ?? '') . ($inter->code ? ' - ' : '') . $inter->fullname;})->join(', ')); ?></span>
<?php else: ?>
<?php if($canAssignInter): ?>
<div id="inter-assignment-form" style="display: flex; align-items: flex-start; gap: 8px;">
<label class="form-label mb-0"
style="white-space: nowrap; padding-top: 6px;"><?php echo app('translator')->get('Phân Inter'); ?>:</label>
<div style="flex: 1; min-width: 0;">
<select name="inter_ids[]" id="inter-select-show" class="form-select select2-bs5"
multiple>
<?php $__currentLoopData = $interAdmins; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $admin): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($admin->id); ?>"><?php echo e($admin->code ?? ''); ?> -
<?php echo e($admin->fullname); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<button type="button" class="btn small btn-sm btn-primary" id="btn-assign-inter"
style="white-space: nowrap; flex-shrink: 0;">
<?php echo app('translator')->get('Xác nhận'); ?>
</button>
</div>
<style>
#inter-assignment-form .select2-container {
width: 100% !important;
}
#inter-assignment-form .select2-selection {
min-height: 38px;
}
</style>
<?php else: ?>
<span><?php echo app('translator')->get('Phân Inter'); ?>: -</span>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<div class="col-md-3 col-12">
<div class="mb-3">
<span><?php echo app('translator')->get('Loại KH'); ?>:
<?php echo e($quoteRequest->customer_type ? $quoteRequest->customer_type->label() : $quoteRequest->customer->type->label() ?? '-'); ?></span>
</div>
</div>
<div class="col-md-3 col-12">
<div class="mb-3">
<span><?php echo app('translator')->get('Ngày sales leader báo giá'); ?>:
<?php echo e($quoteRequest->sales_leader_quote_date ? $quoteRequest->sales_leader_quote_date->format('d/m/Y') : ''); ?></span>
</div>
</div>
</div>
<div class="mt-0">
<div class="d-flex gap-5 align-items-center mb-2">
<span class="form-label"><?php echo app('translator')->get('Chi tiết yêu cầu báo giá'); ?></span>
<?php if($canSelectInterForSale && $quoteRequest->inters->count() > 1): ?>
<div class="d-flex align-items-center gap-2">
<label class="form-label fw-bold"><?php echo app('translator')->get('Chọn Inter báo giá'); ?>:</label>
<select id="select-inter-quote-dropdown" class="form-select form-select-sm" style="width: 250px;">
<option value="">-- Chọn Inter --</option>
<?php $__currentLoopData = $quoteRequest->inters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inter): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($inter->id); ?>"
<?php echo e($quoteRequest->selected_inter_id == $inter->id ? 'selected' : ''); ?>>
<?php echo e(($inter->code ?? '') . ($inter->code ? ' - ' : '') . ($inter->fullname ?? '')); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<?php endif; ?>
</div>
<div class="">
<div class="ui-jqgrid-view table-responsive">
<table id="details-grid"></table>
<div id="details-pager"></div>
</div>
</div>
</div>
<?php
$currentAdmin = get_auth_admin();
$isInter = $currentAdmin && $currentAdmin->isInterOrLeaderInter();
$isSaleOrLeaderSale = $currentAdmin && $currentAdmin->isSaleOrLeaderSale();
$isLeaderOrAbove = $currentAdmin && $currentAdmin->isLeaderOrAbove();
$isAdmin = $currentAdmin ? $currentAdmin->isAdmin() : false;
$isLeaderSale = $currentAdmin && $currentAdmin->role === \Domains\Core\Enums\AdminRole::LEADER_SALE;
$canInterInputPrice =
$isInter &&
in_array($quoteRequest->status, [
\Domains\Core\Enums\QuoteRequestStatus::INTER_ASSIGNED,
\Domains\Core\Enums\QuoteRequestStatus::GETTING_PRICE,
]);
$canInterMarkHasPrice =
$isInter && $quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::INTER_INPUT_PRICE;
$canLeaderEdit =
($isLeaderOrAbove || $isSaleOrLeaderSale || $isAdmin) &&
in_array($quoteRequest->status, [
\Domains\Core\Enums\QuoteRequestStatus::INTER_INPUT_PRICE,
\Domains\Core\Enums\QuoteRequestStatus::INTER_HAS_PRICE,
\Domains\Core\Enums\QuoteRequestStatus::REQUEST_REQUOTE,
\Domains\Core\Enums\QuoteRequestStatus::REQUEST_SALE_CONFIRM,
]);
$canSelectInterQuote =
($isAdmin || $isLeaderSale) && $quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::INTER_HAS_PRICE;
$isSale = $currentAdmin && $currentAdmin->role === \Domains\Core\Enums\AdminRole::SALE;
$canRequestRequote = $isSale && $quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::QUOTED_TO_SALE;
$isRequestRequoteStatus = $quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::REQUEST_REQUOTE;
$canRequestConfirm = $isInter && $quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::INTER_ASSIGNED;
// Sale, LeaderSale và Admin đều có thể trả lời confirm
$canConfirmRequest =
($isSaleOrLeaderSale || $isAdmin) &&
$quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::REQUEST_SALE_CONFIRM;
$canMarkCannotQuote = ($isAdmin || $isLeaderSale) && $quoteRequest->selected_inter_id;
$canMarkQuotedToSale =
($isAdmin || $isLeaderSale) &&
$quoteRequest->status != \Domains\Core\Enums\QuoteRequestStatus::QUOTED_TO_SALE &&
$quoteRequest->status != \Domains\Core\Enums\QuoteRequestStatus::QUOTED_TO_CUSTOMER &&
($quoteRequest->selected_inter_id ||
$quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::REQUEST_REQUOTE);
$canMarkPOReceived =
$isSaleOrLeaderSale &&
in_array($quoteRequest->status, [
\Domains\Core\Enums\QuoteRequestStatus::QUOTED_TO_SALE,
\Domains\Core\Enums\QuoteRequestStatus::QUOTED_TO_CUSTOMER,
]);
$canMarkQuotedToCustomer =
$isSaleOrLeaderSale && $quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::QUOTED_TO_SALE;
$canInterConfirmReceived =
$isInter && $quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::SALE_CONFIRMED;
// Cho phép Sale/LeaderSale/Admin chỉnh sửa các cột ban đầu của Sale khi ở trạng thái REQUEST_SALE_CONFIRM
$canSaleEditOriginalFields =
($isSaleOrLeaderSale || $isAdmin) &&
$quoteRequest->status == \Domains\Core\Enums\QuoteRequestStatus::REQUEST_SALE_CONFIRM;
?>
<?php if(
($isSaleOrLeaderSale || $isAdmin || $isInter) &&
$quoteRequest->confirm_messages &&
count($quoteRequest->confirm_messages) > 0): ?>
<div class="mt-4 mb-2">
<div class="fw-bold mb-2"><?php echo app('translator')->get('Yêu Cầu Confirm:'); ?></div>
<div id="chat-messages-container" class="border rounded bg-white p-3"
style="min-height:200px;max-height:300px;overflow-y:auto;max-width:50%;">
<div class="chat-messages mb-3">
<?php $__currentLoopData = $quoteRequest->confirm_messages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $msg): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php
// Với Inter: chỉ hiển thị yêu cầu của chính mình
if ($isInter && isset($msg['inter_id']) && $msg['inter_id'] != $currentAdmin->id) {
continue;
}
$isInterMessage = ($msg['type'] ?? null) === 'inter_request';
$isSaleMessage = ($msg['type'] ?? null) === 'sale_confirm';
?>
<?php if($isInterMessage): ?>
<div class="d-flex mb-0">
<div class="flex-grow-1" style="max-width:75%;">
<div class="d-inline-block px-3 py-2 text-white shadow-sm"
style="background:#11BFF0;border-radius:18px;max-width:100%;word-wrap:break-word;">
<div style="white-space: pre-line;"><?php echo e($msg['message']); ?></div>
</div>
<div class="mt-1 small text-muted" style="font-style: italic;">
<?php echo e(isset($msg['created_at']) ? \Carbon\Carbon::parse($msg['created_at'])->format('d/m/y H:i') : ''); ?>
- <?php echo e($msg['inter_name'] ?? 'Inter'); ?>
</div>
<?php if(!empty($msg['files']) && is_array($msg['files'])): ?>
<div class="mt-1">
<?php $__currentLoopData = $msg['files']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $file): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php
// Loại bỏ /public/ nếu có trong đường dẫn
$filePath = str_replace('/public/', '', $file);
$filePath = str_replace('public/', '', $filePath);
// Đảm bảo đường dẫn bắt đầu với /
if (!str_starts_with($filePath, '/')) {
$filePath = '/' . $filePath;
}
// Tạo URL đúng
$fileUrl = url($filePath);
// Kiểm tra xem có phải là hình ảnh không
$isImage = preg_match(
'/\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i',
$filePath,
);
?>
<?php if($isImage): ?>
<div class="d-inline-block me-2 mb-2" style="max-width: 200px;">
<a href="<?php echo e($fileUrl); ?>" target="_blank" class="d-block">
<img src="<?php echo e($fileUrl); ?>" alt="File <?php echo e($index + 1); ?>"
class="img-thumbnail"
style="max-width: 200px; max-height: 200px; cursor: pointer;">
</a>
<small class="d-block text-muted text-center mt-1">File
<?php echo e($index + 1); ?></small>
</div>
<?php else: ?>
<a href="<?php echo e($fileUrl); ?>" target="_blank"
class="btn btn-sm btn-outline-primary me-1 mb-1">
<i class="ti ti-file"></i> File <?php echo e($index + 1); ?>
</a>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php endif; ?>
</div>
</div>
<?php elseif($isSaleMessage): ?>
<div class="d-flex mb-3 justify-content-end">
<div class="flex-grow-1" style="max-width:75%;">
<div class="d-flex justify-content-end">
<div class="d-inline-block px-3 py-2 text-dark shadow-sm"
style="background:#E5E5EA;border-radius:18px;max-width:100%;word-wrap:break-word;">
<div style="white-space: pre-line;"><?php echo e($msg['message']); ?></div>
</div>
</div>
<div class="mt-1 small text-muted text-end" style="font-style: italic;">
<?php echo e(isset($msg['created_at']) ? \Carbon\Carbon::parse($msg['created_at'])->format('d/m/y H:i') : ''); ?>
- <?php echo e($msg['sale_name'] ?? 'Sale'); ?>
</div>
<?php if(!empty($msg['files']) && is_array($msg['files'])): ?>
<div class="mt-1 text-end">
<?php $__currentLoopData = $msg['files']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $file): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php
// Loại bỏ /public/ nếu có trong đường dẫn
$filePath = str_replace('/public/', '', $file);
$filePath = str_replace('public/', '', $filePath);
// Đảm bảo đường dẫn bắt đầu với /
if (!str_starts_with($filePath, '/')) {
$filePath = '/' . $filePath;
}
// Tạo URL đúng
$fileUrl = url($filePath);
// Kiểm tra xem có phải là hình ảnh không
$isImage = preg_match(
'/\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i',
$filePath,
);
?>
<?php if($isImage): ?>
<div class="d-inline-block me-2 mb-2" style="max-width: 200px;">
<a href="<?php echo e($fileUrl); ?>" target="_blank" class="d-block">
<img src="<?php echo e($fileUrl); ?>" alt="File <?php echo e($index + 1); ?>"
class="img-thumbnail"
style="max-width: 200px; max-height: 200px; cursor: pointer;">
</a>
<small class="d-block text-muted text-center mt-1">File
<?php echo e($index + 1); ?></small>
</div>
<?php else: ?>
<a href="<?php echo e($fileUrl); ?>" target="_blank"
class="btn btn-sm btn-outline-secondary me-1 mb-1">
<i class="ti ti-file"></i> File <?php echo e($index + 1); ?>
</a>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php if($canConfirmRequest): ?>
<?php
$firstInterRequest = collect($quoteRequest->confirm_messages)->firstWhere('type', 'inter_request');
?>
<?php if($firstInterRequest): ?>
<div class="border-top pt-3 mt-3">
<form class="form-confirm-request"
data-inter-id="<?php echo e($firstInterRequest['inter_id'] ?? ''); ?>">
<div class="position-relative mb-2">
<textarea class="form-control confirm-response-message" rows="3" placeholder="<?php echo app('translator')->get('Nhập tin nhắn...'); ?>"
style="resize:none;padding-right:180px;padding-bottom:60px;"></textarea>
<div class="position-absolute" style="bottom:8px;right:8px;display:flex;gap:8px;">
<label for="confirm-files-<?php echo e($firstInterRequest['inter_id'] ?? ''); ?>"
class="btn btn-sm btn-outline-primary mb-0" style="cursor:pointer;margin:0;">
<i class="ti ti-arrow-up"></i> <?php echo app('translator')->get('Đính kèm'); ?>
</label>
<input type="file"
id="confirm-files-<?php echo e($firstInterRequest['inter_id'] ?? ''); ?>"
class="d-none confirm-files" multiple
accept="image/*,.pdf,.doc,.docx,.xls,.xlsx">
<button type="button" class="btn btn-sm btn-primary btn-confirm-request"
data-inter-id="<?php echo e($firstInterRequest['inter_id'] ?? ''); ?>">
<i class="ti ti-send"></i> <?php echo app('translator')->get('Gửi'); ?>
</button>
</div>
</div>
<div class="file-preview-container mb-2"
style="display:none;max-height:150px;overflow-y:auto;padding:8px;background:#f8f9fa;border-radius:4px;border:1px solid #e9ecef;">
</div>
</form>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if($canInterConfirmReceived): ?>
<div id="form-inter-request-confirm-again" class="border-top pt-3 mt-3" style="display: none;">
<form class="form-inter-request-confirm-again">
<div class="position-relative mb-2">
<textarea class="form-control inter-request-confirm-again-message" rows="3" placeholder="<?php echo app('translator')->get('Nhập tin nhắn...'); ?>"
style="resize:none;padding-right:180px;padding-bottom:60px;"></textarea>
<div class="position-absolute" style="bottom:8px;right:8px;display:flex;gap:8px;">
<label for="inter-request-confirm-again-files"
class="btn btn-sm btn-outline-primary mb-0" style="cursor:pointer;margin:0;">
<i class="ti ti-arrow-up"></i> <?php echo app('translator')->get('Đính kèm'); ?>
</label>
<input type="file" id="inter-request-confirm-again-files"
class="d-none inter-request-confirm-again-files" multiple
accept="image/*,.pdf,.doc,.docx,.xls,.xlsx">
<button type="button"
class="btn btn-sm btn-primary btn-submit-request-confirm-again">
<i class="ti ti-send"></i> <?php echo app('translator')->get('Gửi'); ?>
</button>
</div>
</div>
<div class="file-preview-container-inter mb-2"
style="display:none;max-height:150px;overflow-y:auto;padding:8px;background:#f8f9fa;border-radius:4px;border:1px solid #e9ecef;">
</div>
</form>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if($canRequestConfirm || $canRequestRequote): ?>
<div class="mt-4 mb-4">
<div>
<?php if($canRequestConfirm): ?>
<form id="form-request-confirm">
<div class="mb-3">
<div class="mb-2 fw-bold">
<?php if($canRequestConfirm): ?>
<?php echo app('translator')->get('Yêu cầu Confirm'); ?>
<?php elseif($canConfirmRequest): ?>
<?php echo app('translator')->get('Xác nhận yêu cầu'); ?>
<?php elseif($canRequestRequote): ?>
<?php echo app('translator')->get('Yêu cầu báo giá lại'); ?>
<?php endif; ?>
</div>
<textarea name="message" id="confirm-request-message" class="form-control" rows="4"
placeholder="<?php echo app('translator')->get('Nhập nội dung yêu cầu confirm...'); ?>" style="width: 50%;"></textarea>
</div>
<button type="button" class="btn small btn-primary" id="btn-request-confirm">
<?php echo app('translator')->get('Gửi yêu cầu'); ?>
</button>
</form>
<?php elseif($canConfirmRequest): ?>
<?php if($quoteRequest->confirm_messages && count($quoteRequest->confirm_messages) > 0): ?>
<div class="mb-3">
<h5><?php echo app('translator')->get('Lịch sử yêu cầu'); ?></h5>
<?php $__currentLoopData = $quoteRequest->confirm_messages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $msg): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if($msg['type'] == 'inter_request'): ?>
<div class="mb-3 border rounded p-2">
<div class="mb-1 fw-semibold">
<?php echo e($msg['inter_name'] ?? 'Inter'); ?>
<small class="text-muted">
<?php echo e(isset($msg['created_at']) ? \Carbon\Carbon::parse($msg['created_at'])->format('d/m/Y H:i') : ''); ?>
</small>
</div>
<div class="mb-2" style="white-space: pre-line;">
<?php echo e($msg['message']); ?>
</div>
<form class="form-confirm-request" data-inter-id="<?php echo e($msg['inter_id'] ?? ''); ?>">
<div class="mb-2">
<textarea class="form-control confirm-response-message" rows="2" placeholder="<?php echo app('translator')->get('Nhập nội dung trả lời cho Inter này...'); ?>"></textarea>
</div>
<div class="mb-2">
<input type="file" class="form-control form-control-sm confirm-files"
multiple>
</div>
<button type="button" class="btn btn-primary btn-confirm-request"
data-inter-id="<?php echo e($msg['inter_id'] ?? ''); ?>">
<?php echo app('translator')->get('Confirm'); ?>
</button>
</form>
</div>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php endif; ?>
<?php elseif($canRequestRequote): ?>
<form id="form-request-requote" style="display: none; max-width: 50%;" class="mt-3">
<div class="mb-3">
<div class="mb-2 fw-bold"><?php echo app('translator')->get('Yêu cầu báo giá lại:'); ?></div>
<textarea name="message" id="requote-request-message" class="form-control" rows="6"
placeholder="<?php echo app('translator')->get('Nhập nội dung yêu cầu báo giá lại...'); ?>"></textarea>
</div>
<div class="d-flex justify-content-end">
<button type="button" class="btn btn-primary small" id="btn-submit-requote">
<?php echo app('translator')->get('Gửi'); ?>
</button>
</div>
</form>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if($quoteRequest->requote_request_message && !$isInter): ?>
<div class="mt-4 mb-4" style="max-width: 50%;">
<div class="mb-2 fw-bold"><?php echo app('translator')->get('Yêu cầu báo giá lại:'); ?></div>
<textarea class="form-control" rows="6" readonly style="resize: none; background-color: white;"><?php echo e($quoteRequest->requote_request_message); ?></textarea>
</div>
<?php endif; ?>
<div class="mt-3">
<label class="form-label"><?php echo app('translator')->get('File đính kèm'); ?></label>
<?php if(
$quoteRequest->attached_files &&
is_array($quoteRequest->attached_files) &&
count($quoteRequest->attached_files) > 0): ?>
<div class="d-flex flex-wrap gap-2">
<?php $__currentLoopData = $quoteRequest->attached_files; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $file): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php
$filePath = $file;
$filePath = str_replace('/public/', '', $filePath);
$filePath = str_replace('public/', '', $filePath);
if (!str_starts_with($filePath, '/')) {
$filePath = '/' . $filePath;
}
$fileUrl = asset($filePath);
$fileName = basename($filePath);
$isImage = preg_match('/\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i', $filePath);
?>
<div class="d-inline-block position-relative"
style="border:1px solid #ddd;border-radius:4px;padding:8px;background:#f8f9fa;">
<?php if($isImage): ?>
<a href="<?php echo e($fileUrl); ?>" target="_blank" class="d-block text-decoration-none">
<img src="<?php echo e($fileUrl); ?>" alt="<?php echo e($fileName); ?>"
style="max-width: 150px; max-height: 150px; border-radius: 4px; display: block;">
<small class="d-block text-center text-muted mt-1"
style="max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"><?php echo e($fileName); ?></small>
</a>
<?php else: ?>
<a href="<?php echo e($fileUrl); ?>" target="_blank"
class="btn btn-sm btn-outline-primary d-flex align-items-center gap-1">
<i class="ti ti-file"></i>
<span
style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"><?php echo e($fileName); ?></span>
</a>
<?php endif; ?>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php endif; ?>
</div>
<div class="mt-4 d-flex justify-content-between btn-action-footer">
<div>
<button type="button" class="btn btn-secondary" onclick="window.close() || history.back()">
<?php echo app('translator')->get('Đóng'); ?> (ESC)
</button>
</div>
<div class="d-flex gap-2">
<?php if($isInter): ?>
<button type="button" class="btn btn-primary" id="btn-save-inter-details" title="Lưu">
Lưu (Ctrl+S)
</button>
<?php if($canInterInputPrice): ?>
<button type="button" class="btn btn-primary" id="btn-mark-inter-input-price">
INTER ĐÃ NHẬP GIÁ
</button>
<?php endif; ?>
<?php if($canInterMarkHasPrice): ?>
<button type="button" class="btn btn-primary" id="btn-inter-mark-has-price">
INTER ĐÃ CÓ GIÁ
</button>
<?php endif; ?>
<?php if($canInterConfirmReceived): ?>
<button type="button" class="btn btn-primary" id="btn-inter-confirm-received" data-confirmed="1">
<?php echo app('translator')->get('Xác nhận đã nhận'); ?>
</button>
<button type="button" class="btn btn-primary" id="btn-inter-request-confirm-again"
data-confirmed="0">
<?php echo app('translator')->get('Yêu cầu confirm lại'); ?>
</button>
<?php endif; ?>
<?php endif; ?>
<?php if($canLeaderEdit): ?>
<button type="button" class="btn btn-primary" id="btn-save-leader-details">
Lưu (Ctrl+S)
</button>
<?php endif; ?>
<?php if($canMarkCannotQuote): ?>
<button type="button" class="btn btn-danger" id="btn-mark-cannot-quote" data-bs-toggle="modal"
data-bs-target="#modalCannotQuote">
<?php echo app('translator')->get('Không báo giá được'); ?>
</button>
<?php endif; ?>
<?php if($canMarkQuotedToSale): ?>
<button type="button" class="btn btn-primary" id="btn-mark-quoted-to-sale">
<?php echo app('translator')->get('Đã báo giá Sale'); ?>
</button>
<?php endif; ?>
<?php if($canRequestRequote): ?>
<button type="button" class="btn btn-primary" id="btn-request-requote">
<?php echo app('translator')->get('Gửi yêu cầu báo giá lại'); ?>
</button>
<?php endif; ?>
<?php if($canMarkQuotedToCustomer): ?>
<button type="button" class="btn btn-primary" id="btn-mark-quoted-to-customer">
<?php echo app('translator')->get('Đã báo giá khách'); ?>
</button>
<?php endif; ?>
<?php if($canMarkPOReceived): ?>
<button type="button" class="btn btn-primary" id="btn-mark-po-received">
<?php echo app('translator')->get('Đã có PO'); ?>
</button>
<?php endif; ?>
</div>
</div>
<!-- Modal Không báo giá được -->
<?php if($canMarkCannotQuote): ?>
<div class="modal fade" id="modalCannotQuote" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?php echo app('translator')->get('Không báo giá được'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="form-cannot-quote">
<div class="mb-3">
<label class="form-label"><?php echo app('translator')->get('Lý do'); ?> <span class="text-danger">*</span></label>
<textarea name="reason" id="cannot-quote-reason" class="form-control" rows="4" required
placeholder="<?php echo app('translator')->get('Nhập lý do không báo giá được...'); ?>"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary small"
data-bs-dismiss="modal"><?php echo app('translator')->get('Hủy'); ?></button>
<button type="button" class="btn btn-danger small"
id="btn-submit-cannot-quote"><?php echo app('translator')->get('Xác nhận'); ?></button>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php $__env->startPush('js'); ?>
<script>
function scrollChatToBottom() {
var $chatContainer = $('#chat-messages-container');
if ($chatContainer.length) {
$chatContainer.scrollTop($chatContainer[0].scrollHeight);
}
}
$(document).ready(function() {
scrollChatToBottom();
$(window).on('load', function() {
setTimeout(scrollChatToBottom, 100);
});
setTimeout(scrollChatToBottom, 200);
// Initialize month/year picker
var fromMonthInput = document.getElementById('from-month-year');
var toMonthInput = document.getElementById('to-month-year');
if (fromMonthInput && toMonthInput && typeof Litepicker !== 'undefined') {
// Set default values to current month
var currentDate = new Date();
var currentMonth = String(currentDate.getMonth() + 1).padStart(2, '0');
var currentYear = currentDate.getFullYear();
var defaultDate = currentMonth + '/' + currentYear;
// Set previous month for "to" field
var prevMonth = currentDate.getMonth() === 0 ? 12 : currentDate.getMonth();
var prevYear = currentDate.getMonth() === 0 ? currentYear - 1 : currentYear;
var prevMonthStr = String(prevMonth).padStart(2, '0');
var defaultToDate = prevMonthStr + '/' + prevYear;
if (!fromMonthInput.value) fromMonthInput.value = defaultDate;
if (!toMonthInput.value) toMonthInput.value = defaultToDate;
var monthPicker = new Litepicker({
element: fromMonthInput,
elementEnd: toMonthInput,
format: 'MM/YYYY',
lang: 'en-US',
numberOfMonths: 1,
numberOfColumns: 1,
singleMode: false,
dropdowns: {
minYear: 2020,
maxYear: 2100,
months: true,
years: true
},
setup: function(picker) {
picker.on('show', function() {
// Force show month view
setTimeout(function() {
if (picker.container) {
// Hide calendar days
var calendarContainer = picker.container
.querySelector('.container__calendar');
if (calendarContainer) {
var dayItems = calendarContainer
.querySelectorAll('.day-item');
dayItems.forEach(function(day) {
day.style.display = 'none';
});
}
// Show month picker if available
var monthContainer = picker.container.querySelector(
'.container__months');
if (monthContainer) {
monthContainer.style.display = 'grid';
}
// Click on month button to show month picker
var monthButton = picker.container.querySelector(
'.button--month');
if (monthButton && !monthButton.classList.contains(
'is-active')) {
monthButton.click();
}
}
}, 50);
});
picker.on('render', function() {
setTimeout(function() {
if (picker.container) {
// Hide day items
var dayItems = picker.container.querySelectorAll(
'.day-item');
dayItems.forEach(function(day) {
day.style.display = 'none';
});
// Ensure month grid is visible
var monthContainer = picker.container.querySelector(
'.container__months');
if (monthContainer) {
monthContainer.style.display = 'grid';
}
}
}, 100);
});
},
onSelect: function(start, end) {
if (start) {
var month = String(start.getMonth() + 1).padStart(2, '0');
var year = start.getFullYear();
fromMonthInput.value = month + '/' + year;
}
if (end) {
var month = String(end.getMonth() + 1).padStart(2, '0');
var year = end.getFullYear();
toMonthInput.value = month + '/' + year;
}
}
});
}
});
</script>
<?php $__env->stopPush(); ?>
<?php /**PATH /www/wwwroot/erp.nhatnamsst.com/resources/views/cms/quote_requests/forms/show-left.blade.php ENDPATH**/ ?>