Compare commits

..

1 Commits

Author SHA1 Message Date
6a8ccb8a89 Bump ansi-regex from 5.0.0 to 5.0.1
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-11 11:21:50 +00:00
399 changed files with 6973 additions and 31040 deletions

2
.gitignore vendored
View File

@ -14,5 +14,3 @@ Homestead.yaml
/.vscode
/docker-compose/db/data/
.gitkeep
/public/docs
/.scribe

28
Dockerfile Executable file → Normal file
View File

@ -1,9 +1,8 @@
FROM php:7.4-fpm
WORKDIR /var/www
COPY ./docker-compose/php/uploads.ini /usr/local/etc/php/conf.d/uploads.ini
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
@ -16,21 +15,26 @@ RUN apt-get update && apt-get install -y \
unzip \
libzip-dev \
libmagickwand-dev \
mariadb-client \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
mariadb-client
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pecl install imagick \
&& docker-php-ext-enable imagick
# Install PHP extensions
RUN rmdir html && docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath gd
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath gd
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN useradd -G www-data,root -u 1000 -d /home/crater crater && chmod 777 /var/www/ && chown 1000:1000 /var/www/
USER 0
# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user
# Set working directory
WORKDIR /var/www
COPY ./docker-compose/startup.sh /startup.sh
CMD ["/startup.sh"]
USER $user

View File

@ -40,13 +40,10 @@ class CheckInvoiceStatus extends Command
public function handle()
{
$date = Carbon::now();
$invoices = Invoice::whereNotIn('status', [Invoice::STATUS_COMPLETED, Invoice::STATUS_DRAFT])
->where('overdue', false)
->whereDate('due_date', '<', $date)
->get();
$invoices = Invoice::where('status', '<>', Invoice::STATUS_COMPLETED)->whereDate('due_date', '<', $date)->get();
foreach ($invoices as $invoice) {
$invoice->overdue = true;
$invoice->status = Invoice::STATUS_OVERDUE;
printf("Invoice %s is OVERDUE \n", $invoice->invoice_number);
$invoice->save();
}

View File

@ -2,7 +2,6 @@
namespace Crater\Console;
use Crater\Models\CompanySetting;
use Crater\Models\RecurringInvoice;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
@ -38,11 +37,9 @@ class Kernel extends ConsoleKernel
$recurringInvoices = RecurringInvoice::where('status', 'ACTIVE')->get();
foreach ($recurringInvoices as $recurringInvoice) {
$timeZone = CompanySetting::getSetting('time_zone', $recurringInvoice->company_id);
$schedule->call(function () use ($recurringInvoice) {
$recurringInvoice->generateInvoice();
})->cron($recurringInvoice->frequency)->timezone($timeZone);
})->cron($recurringInvoice->frequency);
}
}
}

View File

@ -12,7 +12,6 @@ use Crater\Models\Expense;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
class DashboardController extends Controller
{
@ -152,8 +151,8 @@ class DashboardController extends Controller
'total_invoice_count' => $total_invoice_count,
'total_estimate_count' => $total_estimate_count,
'recent_due_invoices' => BouncerFacade::can('view-invoice', Invoice::class) ? $recent_due_invoices : [],
'recent_estimates' => BouncerFacade::can('view-estimate', Estimate::class) ? $recent_estimates : [],
'recent_due_invoices' => $recent_due_invoices,
'recent_estimates' => $recent_estimates,
'chart_data' => $chart_data,

View File

@ -3,7 +3,7 @@
namespace Crater\Http\Controllers\V1\Admin\Expense;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\UploadExpenseReceiptRequest;
use Crater\Http\Requests\ExpenseRequest;
use Crater\Models\Expense;
class UploadReceiptController extends Controller
@ -15,7 +15,7 @@ class UploadReceiptController extends Controller
* @param Expense $expense
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(UploadExpenseReceiptRequest $request, Expense $expense)
public function __invoke(ExpenseRequest $request, Expense $expense)
{
$this->authorize('update', $expense);

View File

@ -49,16 +49,7 @@ class BootstrapController extends Controller
BouncerFacade::refreshFor($current_user);
$global_settings = Setting::getSettings([
'api_token',
'admin_portal_theme',
'admin_portal_logo',
'login_page_logo',
'login_page_heading',
'login_page_description',
'admin_page_title',
'copyright_text'
]);
$global_settings = Setting::getSettings(['api_token', 'admin_portal_theme']);
return response()->json([
'current_user' => new UserResource($current_user),

View File

@ -102,7 +102,7 @@ class InvoicesController extends Controller
{
$this->authorize('delete multiple invoices');
Invoice::deleteInvoices($request->ids);
Invoice::destroy($request->ids);
return response()->json([
'success' => true,

View File

@ -84,12 +84,10 @@ class PaymentMethodsController extends Controller
{
$this->authorize('delete', $paymentMethod);
if ($paymentMethod->payments()->exists()) {
return respondJson('payments_attached', 'Payments Attached.');
}
$payments = $paymentMethod->payments;
if ($paymentMethod->expenses()->exists()) {
return respondJson('expenses_attached', 'Expenses Attached.');
if ($payments->count() > 0) {
return respondJson('payments_attached', 'Payments Attached.');
}
$paymentMethod->delete();

View File

@ -71,9 +71,6 @@ class CompanyController extends Controller
$data = json_decode($request->company_logo);
if (isset($request->is_company_logo_removed) && (bool) $request->is_company_logo_removed) {
$company->clearMediaCollection('logo');
}
if ($data) {
$company = Company::find($request->header('company'));
@ -101,9 +98,6 @@ class CompanyController extends Controller
{
$user = auth()->user();
if (isset($request->is_admin_avatar_removed) && (bool) $request->is_admin_avatar_removed) {
$user->clearMediaCollection('admin_avatar');
}
if ($user && $request->hasFile('admin_avatar')) {
$user->clearMediaCollection('admin_avatar');

View File

@ -1,27 +0,0 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Settings;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Illuminate\Http\Request;
class CompanyCurrencyCheckTransactionsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$company = Company::find($request->header('company'));
$this->authorize('manage company', $company);
return response()->json([
'has_transactions' => $company->hasTransactions(),
]);
}
}

View File

@ -6,7 +6,6 @@ use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\UpdateSettingsRequest;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Illuminate\Support\Arr;
class UpdateCompanySettingsController extends Controller
{
@ -18,23 +17,9 @@ class UpdateCompanySettingsController extends Controller
*/
public function __invoke(UpdateSettingsRequest $request)
{
$company = Company::find($request->header('company'));
$this->authorize('manage company', $company);
$this->authorize('manage company', Company::find($request->header('company')));
$data = $request->settings;
if (
Arr::exists($data, 'currency') &&
(CompanySetting::getSetting('currency', $company->id) !== $data['currency']) &&
$company->hasTransactions()
) {
return response()->json([
'success' => false,
'message' => 'Cannot update company currency after transactions are created.'
]);
}
CompanySetting::setSettings($data, $request->header('company'));
CompanySetting::setSettings($request->settings, $request->header('company'));
return response()->json([
'success' => true,

View File

@ -3,6 +3,7 @@
namespace Crater\Http\Controllers\V1\Customer\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\CustomerEstimateStatusRequest;
use Crater\Http\Resources\Customer\EstimateResource;
use Crater\Models\Company;
use Crater\Models\Estimate;

View File

@ -17,9 +17,6 @@ class ProfileController extends Controller
$customer->update($request->validated());
if (isset($request->is_customer_avatar_removed) && (bool) $request->is_customer_avatar_removed) {
$customer->clearMediaCollection('customer_avatar');
}
if ($customer && $request->hasFile('customer_avatar')) {
$customer->clearMediaCollection('customer_avatar');

View File

@ -44,8 +44,8 @@ class InvoicePdfController extends Controller
}
return view('app')->with([
'customer_logo' => get_company_setting('customer_portal_logo', $invoice->company_id),
'current_theme' => get_company_setting('customer_portal_theme', $invoice->company_id)
'customer_logo' => get_customer_logo($invoice->company_id),
'current_theme' => get_customer_portal_theme($invoice->company_id)
]);
}

View File

@ -17,8 +17,6 @@ class DownloadReceiptController extends Controller
*/
public function __invoke(Expense $expense)
{
$this->authorize('view', $expense);
if ($expense) {
$media = $expense->getFirstMedia('receipts');
if ($media) {

View File

@ -4,7 +4,6 @@ namespace Crater\Http\Controllers\V1\PDF;
use Crater\Http\Controllers\Controller;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class EstimatePdfController extends Controller
{
@ -14,13 +13,8 @@ class EstimatePdfController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Estimate $estimate)
public function __invoke(Estimate $estimate)
{
if ($request->has('preview')) {
return $estimate->getPDFData();
}
return $estimate->getGeneratedPDFOrStream('estimate');
}
}

View File

@ -4,7 +4,6 @@ namespace Crater\Http\Controllers\V1\PDF;
use Crater\Http\Controllers\Controller;
use Crater\Models\Invoice;
use Illuminate\Http\Request;
class InvoicePdfController extends Controller
{
@ -14,12 +13,8 @@ class InvoicePdfController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Invoice $invoice)
public function __invoke(Invoice $invoice)
{
if ($request->has('preview')) {
return $invoice->getPDFData();
}
return $invoice->getGeneratedPDFOrStream('invoice');
}
}

View File

@ -4,7 +4,6 @@ namespace Crater\Http\Controllers\V1\PDF;
use Crater\Http\Controllers\Controller;
use Crater\Models\Payment;
use Illuminate\Http\Request;
class PaymentPdfController extends Controller
{
@ -14,12 +13,8 @@ class PaymentPdfController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Payment $payment)
public function __invoke(Payment $payment)
{
if ($request->has('preview')) {
return view('app.pdf.payment.payment');
}
return $payment->getGeneratedPDFOrStream('payment');
}
}

View File

@ -3,6 +3,7 @@
namespace Crater\Http\Middleware;
use Closure;
use Crater\Models\CompanySetting;
use Crater\Models\FileDisk;
class ConfigMiddleware
@ -17,6 +18,15 @@ class ConfigMiddleware
public function handle($request, Closure $next)
{
if (\Storage::disk('local')->has('database_created')) {
$setting = CompanySetting::getSetting('time_zone', $request->header('company'));
$timezone = config('app.timezone');
if ($setting && $setting != null && $setting != $timezone) {
config(['app.timezone' => $setting]);
date_default_timezone_set($setting);
}
if ($request->has('file_disk_id')) {
$file_disk = FileDisk::find($request->file_disk_id);
} else {

View File

@ -17,7 +17,7 @@ class PdfMiddleware
*/
public function handle(Request $request, Closure $next)
{
if (Auth::guard('web')->check() || Auth::guard('sanctum')->check() || Auth::guard('customer')->check()) {
if (Auth::guard('web')->check() || Auth::guard('api')->check() || Auth::guard('customer')->check()) {
return $next($request);
}

View File

@ -92,12 +92,6 @@ class CustomerProfileRequest extends FormRequest
],
'shipping.fax' => [
'nullable',
],
'customer_avatar' => [
'nullable',
'file',
'mimes:gif,jpg,png',
'max:20000'
]
];
}

View File

@ -1,34 +0,0 @@
<?php
namespace Crater\Http\Requests;
use Crater\Rules\Base64Mime;
use Illuminate\Foundation\Http\FormRequest;
class UploadExpenseReceiptRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'upload_receipt' => [
'nullable',
new Base64Mime(['gif', 'jpg', 'png'])
]
];
}
}

View File

@ -24,7 +24,7 @@ class InvoiceResource extends JsonResource
'paid_status' => $this->paid_status,
'tax_per_item' => $this->tax_per_item,
'discount_per_item' => $this->discount_per_item,
'notes' => $this->getNotes(),
'notes' => $this->notes,
'discount_type' => $this->discount_type,
'discount' => $this->discount,
'discount_val' => $this->discount_val,
@ -46,12 +46,10 @@ class InvoiceResource extends JsonResource
'base_due_amount' => $this->base_due_amount,
'currency_id' => $this->currency_id,
'formatted_created_at' => $this->formattedCreatedAt,
'formatted_notes' => $this->formattedNotes,
'invoice_pdf_url' => $this->invoicePdfUrl,
'formatted_invoice_date' => $this->formattedInvoiceDate,
'formatted_due_date' => $this->formattedDueDate,
'payment_module_enabled' => $this->payment_module_enabled,
'overdue' => $this->overdue,
'items' => $this->when($this->items()->exists(), function () {
return InvoiceItemResource::collection($this->items);
}),

View File

@ -23,7 +23,7 @@ class EstimateResource extends JsonResource
'reference_number' => $this->reference_number,
'tax_per_item' => $this->tax_per_item,
'discount_per_item' => $this->discount_per_item,
'notes' => $this->getNotes(),
'notes' => $this->notes,
'discount' => $this->discount,
'discount_type' => $this->discount_type,
'discount_val' => $this->discount_val,

View File

@ -55,7 +55,6 @@ class InvoiceResource extends JsonResource
'payment_module_enabled' => $this->payment_module_enabled,
'sales_tax_type' => $this->sales_tax_type,
'sales_tax_address_type' => $this->sales_tax_address_type,
'overdue' => $this->overdue,
'items' => $this->when($this->items()->exists(), function () {
return InvoiceItemResource::collection($this->items);
}),

View File

@ -18,7 +18,7 @@ class PaymentResource extends JsonResource
'id' => $this->id,
'payment_number' => $this->payment_number,
'payment_date' => $this->payment_date,
'notes' => $this->getNotes(),
'notes' => $this->notes,
'amount' => $this->amount,
'unique_hash' => $this->unique_hash,
'invoice_id' => $this->invoice_id,

View File

@ -217,7 +217,7 @@ class Company extends Model implements HasMedia
'estimate_billing_address_format' => $billingAddressFormat,
'payment_company_address_format' => $companyAddressFormat,
'payment_from_customer_address_format' => $paymentFromCustomerAddress,
'currency' => request()->currency ?? 13,
'currency' => request()->currency ?? 12,
'time_zone' => 'Asia/Kolkata',
'language' => 'en',
'fiscal_year' => '1-12',
@ -300,10 +300,6 @@ class Company extends Model implements HasMedia
if ($this->invoices()->exists()) {
$this->invoices->map(function ($invoice) {
$this->checkModelData($invoice);
if ($invoice->transactions()->exists()) {
$invoice->transactions()->delete();
}
});
$this->invoices()->delete();
@ -380,21 +376,4 @@ class Company extends Model implements HasMedia
$model->taxes()->delete();
}
}
public function hasTransactions()
{
if (
$this->customers()->exists() ||
$this->items()->exists() ||
$this->invoices()->exists() ||
$this->estimates()->exists() ||
$this->expenses()->exists() ||
$this->payments()->exists() ||
$this->recurringInvoices()->exists()
) {
return true;
}
return false;
}
}

View File

@ -139,12 +139,7 @@ class Customer extends Authenticatable implements HasMedia
}
if ($customer->invoices()->exists()) {
$customer->invoices->map(function ($invoice) {
if ($invoice->transactions()->exists()) {
$invoice->transactions()->delete();
}
$invoice->delete();
});
$customer->invoices()->delete();
}
if ($customer->payments()->exists()) {

View File

@ -412,10 +412,6 @@ class Estimate extends Model implements HasMedia
'taxes' => $taxes,
]);
if (request()->has('preview')) {
return view('app.pdf.estimate.'.$estimateTemplate);
}
return PDF::loadView('app.pdf.estimate.'.$estimateTemplate);
}
@ -484,6 +480,7 @@ class Estimate extends Model implements HasMedia
'{ESTIMATE_EXPIRY_DATE}' => $this->formattedExpiryDate,
'{ESTIMATE_NUMBER}' => $this->estimate_number,
'{ESTIMATE_REF_NUMBER}' => $this->reference_number,
'{ESTIMATE_LINK}' => url('/customer/estimates/pdf/'.$this->unique_hash),
];
}

View File

@ -262,9 +262,6 @@ class Expense extends Model implements HasMedia
ExchangeRateLog::addExchangeRateLog($this);
}
if (isset($request->is_attachment_receipt_removed) && (bool) $request->is_attachment_receipt_removed) {
$this->clearMediaCollection('receipts');
}
if ($request->hasFile('attachment_receipt')) {
$this->clearMediaCollection('receipts');
$this->addMediaFromRequest('attachment_receipt')->toMediaCollection('receipts');

View File

@ -28,8 +28,10 @@ class Invoice extends Model implements HasMedia
public const STATUS_DRAFT = 'DRAFT';
public const STATUS_SENT = 'SENT';
public const STATUS_VIEWED = 'VIEWED';
public const STATUS_OVERDUE = 'OVERDUE';
public const STATUS_COMPLETED = 'COMPLETED';
public const STATUS_DUE = 'DUE';
public const STATUS_UNPAID = 'UNPAID';
public const STATUS_PARTIALLY_PAID = 'PARTIALLY_PAID';
public const STATUS_PAID = 'PAID';
@ -136,6 +138,7 @@ class Invoice extends Model implements HasMedia
self::STATUS_DRAFT,
self::STATUS_SENT,
self::STATUS_VIEWED,
self::STATUS_OVERDUE,
self::STATUS_COMPLETED,
];
@ -152,7 +155,9 @@ class Invoice extends Model implements HasMedia
public function getPreviousStatus()
{
if ($this->viewed) {
if ($this->due_date < Carbon::now()) {
return self::STATUS_OVERDUE;
} elseif ($this->viewed) {
return self::STATUS_VIEWED;
} elseif ($this->sent) {
return self::STATUS_SENT;
@ -161,11 +166,6 @@ class Invoice extends Model implements HasMedia
}
}
public function getFormattedNotesAttribute($value)
{
return $this->getNotes();
}
public function getFormattedCreatedAtAttribute($value)
{
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
@ -249,7 +249,7 @@ class Invoice extends Model implements HasMedia
$filters->get('status') == self::STATUS_PAID
) {
$query->wherePaidStatus($filters->get('status'));
} elseif ($filters->get('status') == 'DUE') {
} elseif ($filters->get('status') == self::STATUS_DUE) {
$query->whereDueStatus($filters->get('status'));
} else {
$query->whereStatus($filters->get('status'));
@ -498,10 +498,6 @@ class Invoice extends Model implements HasMedia
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
foreach ($invoiceItem['taxes'] as $tax) {
$tax['company_id'] = $invoice->company_id;
$tax['exchange_rate'] = $invoice->exchange_rate;
$tax['base_amount'] = $tax['amount'] * $exchange_rate;
$tax['currency_id'] = $invoice->currency_id;
if (gettype($tax['amount']) !== "NULL") {
if (array_key_exists('recurring_invoice_id', $invoiceItem)) {
unset($invoiceItem['recurring_invoice_id']);
@ -524,7 +520,7 @@ class Invoice extends Model implements HasMedia
foreach ($taxes as $tax) {
$tax['company_id'] = $invoice->company_id;
$tax['exchange_rate'] = $invoice->exchange_rate;
$tax['exchnage_rate'] = $invoice->exchange_rate;
$tax['base_amount'] = $tax['amount'] * $exchange_rate;
$tax['currency_id'] = $invoice->currency_id;
@ -579,10 +575,6 @@ class Invoice extends Model implements HasMedia
'taxes' => $taxes,
]);
if (request()->has('preview')) {
return view('app.pdf.invoice.'.$invoiceTemplate);
}
return PDF::loadView('app.pdf.invoice.'.$invoiceTemplate);
}
@ -651,6 +643,7 @@ class Invoice extends Model implements HasMedia
'{INVOICE_DUE_DATE}' => $this->formattedDueDate,
'{INVOICE_NUMBER}' => $this->invoice_number,
'{INVOICE_REF_NUMBER}' => $this->reference_number,
'{INVOICE_LINK}' => url('/customer/invoices/pdf/'.$this->unique_hash),
];
}
@ -695,7 +688,6 @@ class Invoice extends Model implements HasMedia
if ($amount == 0) {
$this->status = Invoice::STATUS_COMPLETED;
$this->paid_status = Invoice::STATUS_PAID;
$this->overdue = false;
} elseif ($amount == $this->total) {
$this->status = $this->getPreviousStatus();
$this->paid_status = Invoice::STATUS_UNPAID;
@ -706,19 +698,4 @@ class Invoice extends Model implements HasMedia
$this->save();
}
public static function deleteInvoices($ids)
{
foreach ($ids as $id) {
$invoice = self::find($id);
if ($invoice->transactions()->exists()) {
$invoice->transactions()->delete();
}
$invoice->delete();
}
return true;
}
}

View File

@ -375,10 +375,6 @@ class Payment extends Model implements HasMedia
'logo' => $logo ?? null,
]);
if (request()->has('preview')) {
return view('app.pdf.payment.payment');
}
return PDF::loadView('app.pdf.payment.payment');
}
@ -436,6 +432,7 @@ class Payment extends Model implements HasMedia
'{PAYMENT_MODE}' => $this->paymentMethod ? $this->paymentMethod->name : null,
'{PAYMENT_NUMBER}' => $this->payment_number,
'{PAYMENT_AMOUNT}' => $this->reference_number,
'{PAYMENT_LINK}' => url('/customer/payments/pdf/'.$this->unique_hash)
];
}
@ -445,7 +442,7 @@ class Payment extends Model implements HasMedia
$serial = (new SerialNumberFormatter())
->setModel(new Payment())
->setCompany($invoice->company_id)
->setCompany(request()->header('company'))
->setCustomer($invoice->customer_id)
->setNextNumbers();
@ -458,7 +455,7 @@ class Payment extends Model implements HasMedia
$data['exchange_rate'] = $invoice->exchange_rate;
$data['base_amount'] = $data['amount'] * $data['exchange_rate'];
$data['currency_id'] = $invoice->currency_id;
$data['company_id'] = $invoice->company_id;
$data['company_id'] = request()->header('company');
$data['transaction_id'] = $transaction->id;
$payment = Payment::create($data);

View File

@ -31,21 +31,11 @@ class PaymentMethod extends Model
return $this->hasMany(Payment::class);
}
public function expenses()
{
return $this->hasMany(Expense::class);
}
public function company()
{
return $this->belongsTo(Company::class);
}
public function scopeWhereCompanyId($query, $id)
{
$query->where('company_id', $id);
}
public function scopeWhereCompany($query)
{
$query->where('company_id', request()->header('company'));
@ -58,7 +48,7 @@ class PaymentMethod extends Model
public function scopeWhereSearch($query, $search)
{
$query->where('name', 'LIKE', '%'.$search.'%');
$query->where('name', 'LIKE', '%' . $search . '%');
}
public function scopeApplyFilters($query, array $filters)
@ -98,7 +88,8 @@ class PaymentMethod extends Model
public static function getSettings($id)
{
$settings = PaymentMethod::find($id)
$settings = PaymentMethod::whereCompany()
->find($id)
->settings;
return $settings;

View File

@ -305,15 +305,9 @@ class RecurringInvoice extends Model
->setCustomer($this->customer_id)
->setNextNumbers();
$days = CompanySetting::getSetting('invoice_due_date_days', $this->company_id);
if (! $days || $days == "null") {
$days = 7;
}
$newInvoice['creator_id'] = $this->creator_id;
$newInvoice['invoice_date'] = Carbon::today()->format('Y-m-d');
$newInvoice['due_date'] = Carbon::today()->addDays($days)->format('Y-m-d');
$newInvoice['due_date'] = Carbon::today()->addDays(7)->format('Y-m-d');
$newInvoice['status'] = Invoice::STATUS_DRAFT;
$newInvoice['company_id'] = $this->company_id;
$newInvoice['paid_status'] = Invoice::STATUS_UNPAID;

View File

@ -1,36 +0,0 @@
<?php
namespace Crater\Providers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Schema;
class ViewServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
if (\Storage::disk('local')->has('database_created') && Schema::hasTable('settings')) {
View::share('login_page_logo', get_app_setting('login_page_logo'));
View::share('login_page_heading', get_app_setting('login_page_heading'));
View::share('login_page_description', get_app_setting('login_page_description'));
View::share('admin_page_title', get_app_setting('admin_page_title'));
View::share('copyright_text', get_app_setting('copyright_text'));
}
}
}

View File

@ -7,55 +7,51 @@ use Crater\Models\Setting;
use Illuminate\Support\Str;
/**
* Get company setting
* Get current customer theme
*
* @param $company_id
* @return string
*/
function get_company_setting($key, $company_id)
function get_customer_portal_theme($company_id)
{
if (\Storage::disk('local')->has('database_created')) {
return CompanySetting::getSetting($key, $company_id);
return CompanySetting::getSetting('customer_portal_theme', $company_id);
}
}
/**
* Get app setting
* Get current customer logo
*
* @param $company_id
* @return string
*/
function get_app_setting($key)
function get_customer_logo($company_id)
{
if (\Storage::disk('local')->has('database_created')) {
return Setting::getSetting($key);
return CompanySetting::getSetting('customer_portal_logo', $company_id);
}
}
/**
* Get page title
* Get current admin theme
*
* @param $company_id
* @return string
*/
function get_page_title($company_id)
function get_admin_portal_theme()
{
$routeName = Route::currentRouteName();
$pageTitle = null;
$defaultPageTitle = 'Crater - Self Hosted Invoicing Platform';
if (\Storage::disk('local')->has('database_created')) {
if ($routeName === 'customer.dashboard') {
$pageTitle = CompanySetting::getSetting('customer_portal_page_title', $company_id);
$setting = Setting::getSetting('admin_portal_theme');
return $pageTitle ? $pageTitle : $defaultPageTitle;
if ($setting) {
return $setting;
}
$pageTitle = Setting::getSetting('admin_page_title');
return $pageTitle ? $pageTitle : $defaultPageTitle;
return 'crater';
}
return 'crater';
}
/**

View File

@ -16,7 +16,7 @@ trait GeneratesPdfTrait
if ($pdf && file_exists($pdf['path'])) {
return response()->make(file_get_contents($pdf['path']), 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="'.$pdf['file_name'].'"',
'Content-Disposition' => 'inline; filename="'.$pdf['file_name'].'.pdf"',
]);
}
@ -158,10 +158,6 @@ trait GeneratesPdfTrait
$fields['{'.$customField->customField->slug.'}'] = $customField->defaultAnswer;
}
foreach ($fields as $key => $field) {
$fields[$key] = htmlspecialchars($field, ENT_QUOTES, 'UTF-8');
}
return $fields;
}

View File

@ -10,8 +10,8 @@
"require": {
"php": "^7.4 || ^8.0",
"aws/aws-sdk-php": "^3.142",
"barryvdh/laravel-dompdf": "^0.9.0",
"crater-invoice/modules": "^1.0.0",
"barryvdh/laravel-dompdf": "^0.8.7",
"doctrine/dbal": "^2.10",
"dragonmantank/cron-expression": "^3.1",
"fideloper/proxy": "^4.0",
@ -88,4 +88,4 @@
"dont-discover": []
}
}
}
}

67
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bec0a5c13fb0fdf512aa6fc44ca14273",
"content-hash": "b4c1fd7a94025b650a89756e1140b1c0",
"packages": [
{
"name": "asm89/stack-cors",
@ -114,16 +114,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.209.2",
"version": "3.209.1",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "77c14dd84704d2db6c5c4d6a8c1226337e4e6783"
"reference": "3a418a7a9beae4675685efe7bb426ee0ae338a40"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/77c14dd84704d2db6c5c4d6a8c1226337e4e6783",
"reference": "77c14dd84704d2db6c5c4d6a8c1226337e4e6783",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3a418a7a9beae4675685efe7bb426ee0ae338a40",
"reference": "3a418a7a9beae4675685efe7bb426ee0ae338a40",
"shasum": ""
},
"require": {
@ -199,33 +199,33 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.209.2"
"source": "https://github.com/aws/aws-sdk-php/tree/3.209.1"
},
"time": "2022-01-10T19:14:32+00:00"
"time": "2022-01-07T19:12:55+00:00"
},
{
"name": "barryvdh/laravel-dompdf",
"version": "v0.9.0",
"version": "v0.8.7",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "5b99e1f94157d74e450f4c97e8444fcaffa2144b"
"reference": "30310e0a675462bf2aa9d448c8dcbf57fbcc517d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/5b99e1f94157d74e450f4c97e8444fcaffa2144b",
"reference": "5b99e1f94157d74e450f4c97e8444fcaffa2144b",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/30310e0a675462bf2aa9d448c8dcbf57fbcc517d",
"reference": "30310e0a675462bf2aa9d448c8dcbf57fbcc517d",
"shasum": ""
},
"require": {
"dompdf/dompdf": "^1",
"dompdf/dompdf": "^0.8",
"illuminate/support": "^5.5|^6|^7|^8",
"php": "^7.1 || ^8.0"
"php": ">=7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.9-dev"
"dev-master": "0.8-dev"
},
"laravel": {
"providers": [
@ -259,7 +259,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-dompdf/issues",
"source": "https://github.com/barryvdh/laravel-dompdf/tree/v0.9.0"
"source": "https://github.com/barryvdh/laravel-dompdf/tree/master"
},
"funding": [
{
@ -267,7 +267,7 @@
"type": "github"
}
],
"time": "2020-12-27T12:05:53+00:00"
"time": "2020-09-07T11:50:18+00:00"
},
{
"name": "brick/math",
@ -1058,16 +1058,16 @@
},
{
"name": "dompdf/dompdf",
"version": "v1.1.1",
"version": "v0.8.6",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "de4aad040737a89fae2129cdeb0f79c45513128d"
"reference": "db91d81866c69a42dad1d2926f61515a1e3f42c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/de4aad040737a89fae2129cdeb0f79c45513128d",
"reference": "de4aad040737a89fae2129cdeb0f79c45513128d",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/db91d81866c69a42dad1d2926f61515a1e3f42c5",
"reference": "db91d81866c69a42dad1d2926f61515a1e3f42c5",
"shasum": ""
},
"require": {
@ -1075,11 +1075,11 @@
"ext-mbstring": "*",
"phenx/php-font-lib": "^0.5.2",
"phenx/php-svg-lib": "^0.3.3",
"php": "^7.1 || ^8.0"
"php": "^7.1"
},
"require-dev": {
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9",
"phpunit/phpunit": "^7.5",
"squizlabs/php_codesniffer": "^3.5"
},
"suggest": {
@ -1089,6 +1089,11 @@
"ext-zlib": "Needed for pdf stream compression"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.7-dev"
}
},
"autoload": {
"psr-4": {
"Dompdf\\": "src/"
@ -1119,9 +1124,9 @@
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v1.1.1"
"source": "https://github.com/dompdf/dompdf/tree/master"
},
"time": "2021-11-24T00:45:04+00:00"
"time": "2020-08-30T22:54:22+00:00"
},
{
"name": "dragonmantank/cron-expression",
@ -11427,16 +11432,16 @@
},
{
"name": "nunomaduro/collision",
"version": "v5.11.0",
"version": "v5.10.0",
"source": {
"type": "git",
"url": "https://github.com/nunomaduro/collision.git",
"reference": "8b610eef8582ccdc05d8f2ab23305e2d37049461"
"reference": "3004cfa49c022183395eabc6d0e5207dfe498d00"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/8b610eef8582ccdc05d8f2ab23305e2d37049461",
"reference": "8b610eef8582ccdc05d8f2ab23305e2d37049461",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/3004cfa49c022183395eabc6d0e5207dfe498d00",
"reference": "3004cfa49c022183395eabc6d0e5207dfe498d00",
"shasum": ""
},
"require": {
@ -11498,7 +11503,7 @@
},
"funding": [
{
"url": "https://www.paypal.com/paypalme/enunomaduro",
"url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L",
"type": "custom"
},
{
@ -11510,7 +11515,7 @@
"type": "patreon"
}
],
"time": "2022-01-10T16:22:52+00:00"
"time": "2021-09-20T15:06:32+00:00"
},
{
"name": "pestphp/pest",
@ -12407,5 +12412,5 @@
"php": "^7.4 || ^8.0"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.1.0"
}

View File

@ -168,7 +168,6 @@ return [
Crater\Providers\EventServiceProvider::class,
Crater\Providers\RouteServiceProvider::class,
Crater\Providers\DropboxServiceProvider::class,
Crater\Providers\ViewServiceProvider::class,
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
],

View File

@ -68,9 +68,6 @@ return [
["code" => "sv", "name" => "Svenska"],
["code" => "sk", "name" => "Slovak"],
["code" => "vi", "name" => "Tiếng Việt"],
["code" => "cs", "name" => "Czech"],
["code" => "el", "name" => "Greek"],
["code" => "hr", "name" => "Crotian"],
],
/*

View File

@ -1,3 +0,0 @@
files:
- source: /resources/scripts/locales/en.json
translation: /resources/scripts/locales/%two_letters_code%.json

View File

@ -37,6 +37,15 @@ class InvoiceFactory extends Factory
});
}
public function overdue()
{
return $this->state(function (array $attributes) {
return [
'status' => Invoice::STATUS_OVERDUE,
];
});
}
public function completed()
{
return $this->state(function (array $attributes) {
@ -46,6 +55,15 @@ class InvoiceFactory extends Factory
});
}
public function due()
{
return $this->state(function (array $attributes) {
return [
'status' => Invoice::STATUS_DUE,
];
});
}
public function unpaid()
{
return $this->state(function (array $attributes) {

View File

@ -21,7 +21,7 @@ class ChangeEnablePortalFieldOfCustomersTable extends Migration
$customers = Customer::all();
if ($customers) {
$customers->map(function ($customer) {
$customers->map(function ($customer) {
$customer->enable_portal = false;
$customer->save();
});

View File

@ -1,27 +0,0 @@
<?php
use Crater\Models\Setting;
use Illuminate\Database\Migrations\Migration;
class UpdateCraterVersion601 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Setting::setSetting('version', '6.0.1');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,27 +0,0 @@
<?php
use Crater\Models\Setting;
use Illuminate\Database\Migrations\Migration;
class UpdateCraterVersion602 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Setting::setSetting('version', '6.0.2');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,27 +0,0 @@
<?php
use Crater\Models\Setting;
use Illuminate\Database\Migrations\Migration;
class UpdateCraterVersion603 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Setting::setSetting('version', '6.0.3');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,27 +0,0 @@
<?php
use Crater\Models\Setting;
use Illuminate\Database\Migrations\Migration;
class UpdateCraterVersion604 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Setting::setSetting('version', '6.0.4');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateValueColumnToNullableOnSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('value')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddOverdueToInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('invoices', function (Blueprint $table) {
$table->boolean('overdue')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('invoices', function (Blueprint $table) {
$table->dropForeign(['overdue']);
});
}
}

View File

@ -1,27 +0,0 @@
<?php
use Crater\Models\Setting;
use Illuminate\Database\Migrations\Migration;
class CraterVersion605 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Setting::setSetting('version', '6.0.5');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,35 +0,0 @@
<?php
use Crater\Models\Invoice;
use Illuminate\Database\Migrations\Migration;
class ChangeOverDueStatusToSent extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$overdueInvoices = Invoice::where('status', 'OVERDUE')->get();
if ($overdueInvoices) {
$overdueInvoices->map(function ($overdueInvoice) {
$overdueInvoice->status = Invoice::STATUS_SENT;
$overdueInvoice->overdue = true;
$overdueInvoice->save();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,38 +0,0 @@
<?php
use Crater\Models\InvoiceItem;
use Crater\Models\Tax;
use Illuminate\Database\Migrations\Migration;
class CalculateBaseValuesForInvoiceItems extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$taxes = Tax::whereRelation('invoiceItem', 'base_amount', null)->get();
if ($taxes) {
$taxes->map(function ($tax) {
$invoiceItem = InvoiceItem::find($tax->invoice_item_id);
$exchange_rate = $invoiceItem->exchange_rate;
$tax->exchange_rate = $exchange_rate;
$tax->base_amount = $tax->amount * $exchange_rate;
$tax->save();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,27 +0,0 @@
<?php
use Crater\Models\Setting;
use Illuminate\Database\Migrations\Migration;
class UpdateCraterVersion606 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Setting::setSetting('version', '6.0.6');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -106,14 +106,6 @@ class CurrenciesTableSeeder extends Seeder
'thousand_separator' => ',',
'decimal_separator' => '.',
],
[
'name' => 'Nepali Rupee',
'code' => 'NPR',
'symbol' => 'रू',
'precision' => '2',
'thousand_separator' => ',',
'decimal_separator' => '.',
],
[
'name' => 'Indian Rupee',
'code' => 'INR',
@ -583,15 +575,6 @@ class CurrenciesTableSeeder extends Seeder
'thousand_separator' => ',',
'decimal_separator' => '.',
],
[
'name' => 'Macedonian Denar',
'code' => 'MKD',
'symbol' => 'ден',
'precision' => '0',
'thousand_separator' => '.',
'decimal_separator' => ',',
'swap_currency_symbol' => true,
],
];

View File

@ -1,22 +1,25 @@
version: '3'
services:
services:
app:
build: .
image: craterapp/crater
build:
args:
user: crater-user
uid: 1000
context: ./
dockerfile: Dockerfile
image: crater-php
restart: unless-stopped
working_dir: /var/www/
volumes:
- ./:/var/www:z
labels:
ofelia.enabled: "true"
ofelia.job-exec.somecron.schedule: "@every 60s"
ofelia.job-exec.somecron.command: "php artisan schedule:run"
- ./:/var/www
- ./docker-compose/php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini:rw,delegated
networks:
- crater
db:
image: mariadb
restart: unless-stopped
restart: always
volumes:
- db:/var/lib/mysql
# If you want to persist data on the host, comment the line above this one...
@ -38,19 +41,19 @@ services:
ports:
- 80:80
volumes:
- ./:/var/www:z
- ./docker-compose/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- ./:/var/www
- ./docker-compose/nginx:/etc/nginx/conf.d/
networks:
- crater
ofelia:
image: mcuadros/ofelia
restart: unless-stopped
command: daemon --docker
cron:
build:
context: ./
dockerfile: ./docker-compose/cron.dockerfile
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
depends_on:
- app
- ./:/var/www
networks:
- crater
volumes:
db:

View File

@ -0,0 +1,10 @@
FROM php:7.4-fpm-alpine
RUN apk add --no-cache \
php7-bcmath
RUN docker-php-ext-install pdo pdo_mysql bcmath
COPY docker-compose/crontab /etc/crontabs/root
CMD ["crond", "-f"]

1
docker-compose/crontab Normal file
View File

@ -0,0 +1 @@
* * * * * cd /var/www && php artisan schedule:run >> /dev/stdout 2>&1

6
docker-compose/setup.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
docker-compose exec app composer install --no-interaction --prefer-dist --optimize-autoloader
docker-compose exec app php artisan storage:link || true
docker-compose exec app php artisan key:generate

View File

@ -1,16 +0,0 @@
#!/bin/sh
chmod 775 /var/www/ -R
chown 1000:33 /var/www -R
if [ ! -f ".env" ]; then
cp .env.example .env
echo "created .env from .env.example"
fi
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan storage:link || true
php artisan key:generate
php-fpm

View File

@ -33,7 +33,6 @@
"@stripe/stripe-js": "^1.21.2",
"@tailwindcss/line-clamp": "^0.3.0",
"@tiptap/core": "^2.0.0-beta.85",
"@tiptap/extension-text-align": "^2.0.0-beta.29",
"@tiptap/starter-kit": "^2.0.0-beta.81",
"@tiptap/vue-3": "^2.0.0-beta.38",
"@vuelidate/components": "^1.1.12",

View File

@ -0,0 +1 @@
import{G as u,aN as d,k as m,r as n,o as h,e as p,h as s,t as o,f as c,w as f,i as _,u as x}from"./vendor.01d0adc5.js";const g={class:"w-full h-screen h-screen-ios"},w={class:"flex items-center justify-center w-full h-full"},y={class:"flex flex-col items-center justify-center"},b={class:"text-primary-500",style:{"font-size":"10rem"}},v={class:"mb-10 text-3xl text-primary-500"},$={setup(k){const e=u();d();const l=m(()=>{if(e.path.indexOf("customer")>-1&&e.params.company)return`/${e.params.company}/customer/dashboard`;if(e.params.catchAll){let a=e.params.catchAll.indexOf("/");return a>-1?`/${e.params.catchAll.substring(a,0)}/customer/dashboard`:"/"}else return"/admin/dashboard"});return(t,a)=>{const r=n("BaseIcon"),i=n("router-link");return h(),p("div",g,[s("div",w,[s("div",y,[s("h1",b,o(t.$t("general.four_zero_four")),1),s("h5",v,o(t.$t("general.you_got_lost")),1),c(i,{class:"flex items-center w-32 h-12 px-3 py-1 text-base font-medium leading-none text-center text-white rounded whitespace-nowrap bg-primary-500 btn-lg hover:text-white",to:x(l)},{default:f(()=>[c(r,{name:"ArrowLeftIcon",class:"mr-2 text-white icon"}),_(" "+o(t.$t("general.go_home")),1)]),_:1},8,["to"])])])])}}};export{$ as default};

View File

@ -1 +0,0 @@
import{G as u,aN as d,k as m,r as n,o as h,e as p,h as s,t as o,f as c,w as f,i as _,u as x}from"./vendor.d12b5734.js";const g={class:"w-full h-screen"},w={class:"flex items-center justify-center w-full h-full"},y={class:"flex flex-col items-center justify-center"},b={class:"text-primary-500",style:{"font-size":"10rem"}},v={class:"mb-10 text-3xl text-primary-500"},$={setup(k){const e=u();d();const l=m(()=>{if(e.path.indexOf("customer")>-1&&e.params.company)return`/${e.params.company}/customer/dashboard`;if(e.params.catchAll){let a=e.params.catchAll.indexOf("/");return a>-1?`/${e.params.catchAll.substring(a,0)}/customer/dashboard`:"/"}else return"/admin/dashboard"});return(t,a)=>{const r=n("BaseIcon"),i=n("router-link");return h(),p("div",g,[s("div",w,[s("div",y,[s("h1",b,o(t.$t("general.four_zero_four")),1),s("h5",v,o(t.$t("general.you_got_lost")),1),c(i,{class:"flex items-center w-32 h-12 px-3 py-1 text-base font-medium leading-none text-center text-white rounded whitespace-nowrap bg-primary-500 btn-lg hover:text-white",to:x(l)},{default:f(()=>[c(r,{name:"ArrowLeftIcon",class:"mr-2 text-white icon"}),_(" "+o(t.$t("general.go_home")),1)]),_:1},8,["to"])])])])}}};export{$ as default};

View File

@ -1 +0,0 @@
var L=Object.defineProperty,P=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var U=(u,s,i)=>s in u?L(u,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[s]=i,S=(u,s)=>{for(var i in s||(s={}))z.call(s,i)&&U(u,i,s[i]);if(V)for(var i of V(s))E.call(s,i)&&U(u,i,s[i]);return u},I=(u,s)=>P(u,T(s));import{J,B as b,k as y,L as _,M as C,Q,N as H,P as K,a0 as O,T as W,r as m,o as M,e as X,f as r,w as d,u as e,x as Y,l as Z,m as x,j as ee,i as ae,t as se,U as te,h as ne}from"./vendor.d12b5734.js";import{e as oe,d as re,b as le}from"./main.465728e1.js";const ie=["onSubmit"],ue=ne("span",null,null,-1),ce={setup(u){const s=oe(),i=re(),F=le(),{t:v}=J();let p=b(!1),c=b(null),f=b([]);const $=b(!1);s.currentUser.avatar&&f.value.push({image:s.currentUser.avatar});const q=y(()=>({name:{required:_.withMessage(v("validation.required"),C)},email:{required:_.withMessage(v("validation.required"),C),email:_.withMessage(v("validation.email_incorrect"),Q)},password:{minLength:_.withMessage(v("validation.password_length",{count:8}),H(8))},confirm_password:{sameAsPassword:_.withMessage(v("validation.password_incorrect"),K(t.password))}})),t=O({name:s.currentUser.name,email:s.currentUser.email,language:s.currentUserSettings.language||F.selectedCompanySettings.language,password:"",confirm_password:""}),o=W(q,y(()=>t));function k(l,a){c.value=a}function N(){c.value=null,$.value=!0}async function A(){if(o.value.$touch(),o.value.$invalid)return!0;p.value=!0;let l={name:t.name,email:t.email};try{if(t.password!=null&&t.password!==void 0&&t.password!==""&&(l=I(S({},l),{password:t.password})),s.currentUserSettings.language!==t.language&&await s.updateUserSettings({settings:{language:t.language}}),(await s.updateCurrentUser(l)).data.data){if(p.value=!1,c.value||$.value){let w=new FormData;c.value&&w.append("admin_avatar",c.value),w.append("is_admin_avatar_removed",$.value),await s.uploadAvatar(w),c.value=null,$.value=!1}t.password="",t.confirm_password=""}}catch{return p.value=!1,!0}}return(l,a)=>{const w=m("BaseFileUploader"),g=m("BaseInputGroup"),B=m("BaseInput"),G=m("BaseMultiselect"),D=m("BaseInputGrid"),R=m("BaseIcon"),h=m("BaseButton"),j=m("BaseSettingCard");return M(),X("form",{class:"relative",onSubmit:te(A,["prevent"])},[r(j,{title:l.$t("settings.account_settings.account_settings"),description:l.$t("settings.account_settings.section_description")},{default:d(()=>[r(D,null,{default:d(()=>[r(g,{label:l.$tc("settings.account_settings.profile_picture")},{default:d(()=>[r(w,{modelValue:e(f),"onUpdate:modelValue":a[0]||(a[0]=n=>Y(f)?f.value=n:f=n),avatar:!0,accept:"image/*",onChange:k,onRemove:N},null,8,["modelValue"])]),_:1},8,["label"]),ue,r(g,{label:l.$tc("settings.account_settings.name"),error:e(o).name.$error&&e(o).name.$errors[0].$message,required:""},{default:d(()=>[r(B,{modelValue:e(t).name,"onUpdate:modelValue":a[1]||(a[1]=n=>e(t).name=n),invalid:e(o).name.$error,onInput:a[2]||(a[2]=n=>e(o).name.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["label","error"]),r(g,{label:l.$tc("settings.account_settings.email"),error:e(o).email.$error&&e(o).email.$errors[0].$message,required:""},{default:d(()=>[r(B,{modelValue:e(t).email,"onUpdate:modelValue":a[3]||(a[3]=n=>e(t).email=n),invalid:e(o).email.$error,onInput:a[4]||(a[4]=n=>e(o).email.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["label","error"]),r(g,{error:e(o).password.$error&&e(o).password.$errors[0].$message,label:l.$tc("settings.account_settings.password")},{default:d(()=>[r(B,{modelValue:e(t).password,"onUpdate:modelValue":a[5]||(a[5]=n=>e(t).password=n),type:"password",onInput:a[6]||(a[6]=n=>e(o).password.$touch())},null,8,["modelValue"])]),_:1},8,["error","label"]),r(g,{label:l.$tc("settings.account_settings.confirm_password"),error:e(o).confirm_password.$error&&e(o).confirm_password.$errors[0].$message},{default:d(()=>[r(B,{modelValue:e(t).confirm_password,"onUpdate:modelValue":a[7]||(a[7]=n=>e(t).confirm_password=n),type:"password",onInput:a[8]||(a[8]=n=>e(o).confirm_password.$touch())},null,8,["modelValue"])]),_:1},8,["label","error"]),r(g,{label:l.$tc("settings.language")},{default:d(()=>[r(G,{modelValue:e(t).language,"onUpdate:modelValue":a[9]||(a[9]=n=>e(t).language=n),options:e(i).config.languages,label:"name","value-prop":"code","track-by":"name","open-direction":"top"},null,8,["modelValue","options"])]),_:1},8,["label"])]),_:1}),r(h,{loading:e(p),disabled:e(p),class:"mt-6"},{left:d(n=>[e(p)?ee("",!0):(M(),Z(R,{key:0,name:"SaveIcon",class:x(n.class)},null,8,["class"]))]),default:d(()=>[ae(" "+se(l.$tc("settings.company_info.save")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title","description"])],40,ie)}}};export{ce as default};

View File

@ -0,0 +1 @@
var L=Object.defineProperty,R=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var b=(u,s,i)=>s in u?L(u,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[s]=i,U=(u,s)=>{for(var i in s||(s={}))T.call(s,i)&&b(u,i,s[i]);if(V)for(var i of V(s))z.call(s,i)&&b(u,i,s[i]);return u},S=(u,s)=>R(u,P(s));import{J as E,B,k as I,L as v,M as y,Q as J,N as Q,P as H,a0 as K,T as O,r as m,o as C,e as W,f as r,w as d,u as e,x as X,l as Y,m as Z,j as x,i as ee,t as ae,U as se,h as te}from"./vendor.01d0adc5.js";import{e as ne,d as oe,b as re}from"./main.75722495.js";const le=["onSubmit"],ie=te("span",null,null,-1),pe={setup(u){const s=ne(),i=oe(),M=re(),{t:g}=E();let p=B(!1),w=B(null),f=B([]);s.currentUser.avatar&&f.value.push({image:s.currentUser.avatar});const F=I(()=>({name:{required:v.withMessage(g("validation.required"),y)},email:{required:v.withMessage(g("validation.required"),y),email:v.withMessage(g("validation.email_incorrect"),J)},password:{minLength:v.withMessage(g("validation.password_length",{count:8}),Q(8))},confirm_password:{sameAsPassword:v.withMessage(g("validation.password_incorrect"),H(t.password))}})),t=K({name:s.currentUser.name,email:s.currentUser.email,language:s.currentUserSettings.language||M.selectedCompanySettings.language,password:"",confirm_password:""}),o=O(F,I(()=>t));function q(l,a){w.value=a}function k(){w.value=null}async function N(){if(o.value.$touch(),o.value.$invalid)return!0;p.value=!0;let l={name:t.name,email:t.email};try{if(t.password!=null&&t.password!==void 0&&t.password!==""&&(l=S(U({},l),{password:t.password})),s.currentUserSettings.language!==t.language&&await s.updateUserSettings({settings:{language:t.language}}),(await s.updateCurrentUser(l)).data.data){if(p.value=!1,w.value){let $=new FormData;$.append("admin_avatar",w.value),await s.uploadAvatar($)}t.password="",t.confirm_password=""}}catch{return p.value=!1,!0}}return(l,a)=>{const $=m("BaseFileUploader"),c=m("BaseInputGroup"),_=m("BaseInput"),G=m("BaseMultiselect"),D=m("BaseInputGrid"),h=m("BaseIcon"),j=m("BaseButton"),A=m("BaseSettingCard");return C(),W("form",{class:"relative",onSubmit:se(N,["prevent"])},[r(A,{title:l.$t("settings.account_settings.account_settings"),description:l.$t("settings.account_settings.section_description")},{default:d(()=>[r(D,null,{default:d(()=>[r(c,{label:l.$tc("settings.account_settings.profile_picture")},{default:d(()=>[r($,{modelValue:e(f),"onUpdate:modelValue":a[0]||(a[0]=n=>X(f)?f.value=n:f=n),avatar:!0,accept:"image/*",onChange:q,onRemove:k},null,8,["modelValue"])]),_:1},8,["label"]),ie,r(c,{label:l.$tc("settings.account_settings.name"),error:e(o).name.$error&&e(o).name.$errors[0].$message,required:""},{default:d(()=>[r(_,{modelValue:e(t).name,"onUpdate:modelValue":a[1]||(a[1]=n=>e(t).name=n),invalid:e(o).name.$error,onInput:a[2]||(a[2]=n=>e(o).name.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["label","error"]),r(c,{label:l.$tc("settings.account_settings.email"),error:e(o).email.$error&&e(o).email.$errors[0].$message,required:""},{default:d(()=>[r(_,{modelValue:e(t).email,"onUpdate:modelValue":a[3]||(a[3]=n=>e(t).email=n),invalid:e(o).email.$error,onInput:a[4]||(a[4]=n=>e(o).email.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["label","error"]),r(c,{error:e(o).password.$error&&e(o).password.$errors[0].$message,label:l.$tc("settings.account_settings.password")},{default:d(()=>[r(_,{modelValue:e(t).password,"onUpdate:modelValue":a[5]||(a[5]=n=>e(t).password=n),type:"password",onInput:a[6]||(a[6]=n=>e(o).password.$touch())},null,8,["modelValue"])]),_:1},8,["error","label"]),r(c,{label:l.$tc("settings.account_settings.confirm_password"),error:e(o).confirm_password.$error&&e(o).confirm_password.$errors[0].$message},{default:d(()=>[r(_,{modelValue:e(t).confirm_password,"onUpdate:modelValue":a[7]||(a[7]=n=>e(t).confirm_password=n),type:"password",onInput:a[8]||(a[8]=n=>e(o).confirm_password.$touch())},null,8,["modelValue"])]),_:1},8,["label","error"]),r(c,{label:l.$tc("settings.language")},{default:d(()=>[r(G,{modelValue:e(t).language,"onUpdate:modelValue":a[9]||(a[9]=n=>e(t).language=n),options:e(i).config.languages,label:"name","value-prop":"code","track-by":"code","open-direction":"top"},null,8,["modelValue","options"])]),_:1},8,["label"])]),_:1}),r(j,{loading:e(p),disabled:e(p),class:"mt-6"},{left:d(n=>[e(p)?x("",!0):(C(),Y(h,{key:0,name:"SaveIcon",class:Z(n.class)},null,8,["class"]))]),default:d(()=>[ee(" "+ae(l.$tc("settings.company_info.save")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title","description"])],40,le)}}};export{pe as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
import{_ as o}from"./main.465728e1.js";import{o as n,e as i,g as l,k as c,r as d,l as m,w as _,j as f,h as $,t as h,s as B}from"./vendor.d12b5734.js";const k={name:"List"},v={class:"list-none"};function x(e,r,t,s,a,p){return n(),i("div",v,[l(e.$slots,"default")])}var L=o(k,[["render",x]]);const y={name:"ListItem",props:{title:{type:String,required:!1,default:""},active:{type:Boolean,required:!0},index:{type:Number,default:null}},setup(e,{slots:r}){const t="cursor-pointer pb-2 pr-0 text-sm font-medium leading-5 flex items-center";let s=c(()=>!!r.icon),a=c(()=>e.active?`${t} text-primary-500`:`${t} text-gray-500`);return{hasIconSlot:s,containerClass:a}}},g={key:0,class:"mr-3"};function C(e,r,t,s,a,p){const u=d("router-link");return n(),m(u,B(e.$attrs,{class:s.containerClass}),{default:_(()=>[s.hasIconSlot?(n(),i("span",g,[l(e.$slots,"icon")])):f("",!0),$("span",null,h(t.title),1)]),_:3},16,["class"])}var b=o(y,[["render",C]]);export{b as B,L as a};

View File

@ -0,0 +1 @@
import{_ as o}from"./main.75722495.js";import{o as n,e as c,g as i,k as l,r as u,l as m,w as _,j as f,h as $,t as h,s as B}from"./vendor.01d0adc5.js";const k={name:"List"},v={class:"list-none"};function x(e,r,t,s,a,d){return n(),c("div",v,[i(e.$slots,"default")])}var L=o(k,[["render",x]]);const y={name:"ListItem",props:{title:{type:String,required:!1,default:""},active:{type:Boolean,required:!0},index:{type:Number,default:null}},setup(e,{slots:r}){const t="cursor-pointer pb-2 pr-0 text-sm font-medium leading-5 flex items-center";let s=l(()=>!!r.icon),a=l(()=>e.active?`${t} text-primary-500`:`${t} text-gray-500`);return{hasIconSlot:s,containerClass:a}}},g={key:0,class:"mr-3"};function C(e,r,t,s,a,d){const p=u("router-link");return n(),m(p,B(e.$attrs,{class:s.containerClass}),{default:_(()=>[s.hasIconSlot?(n(),c("span",g,[i(e.$slots,"icon")])):f("",!0),$("span",null,h(t.title),1)]),_:3},16,["class"])}var j=o(y,[["render",C]]);export{j as B,L as a};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{J as j,B as k,k as g,L as y,M as N,N as L,S as T,T as q,r as i,o as B,l as b,w as r,h as m,i as f,t as C,u as e,f as n,m as D,j as G,U}from"./vendor.d12b5734.js";import{u as z}from"./category.c88b90cd.js";import{c as E}from"./main.465728e1.js";const A={class:"flex justify-between w-full"},J=["onSubmit"],X={class:"p-8 sm:p-6"},F={class:"z-0 flex justify-end p-4 border-t border-gray-200 border-solid border-modal-bg"},Q={setup(H){const t=z(),u=E(),{t:p}=j();let c=k(!1);const h=g(()=>({currentCategory:{name:{required:y.withMessage(p("validation.required"),N),minLength:y.withMessage(p("validation.name_min_length",{count:3}),L(3))},description:{maxLength:y.withMessage(p("validation.description_maxlength",{count:255}),T(255))}}})),o=q(h,g(()=>t)),w=g(()=>u.active&&u.componentName==="CategoryModal");async function I(){if(o.value.currentCategory.$touch(),o.value.currentCategory.$invalid)return!0;const s=t.isEdit?t.updateCategory:t.addCategory;c.value=!0,await s(t.currentCategory),c.value=!1,u.refreshData&&u.refreshData(),d()}function d(){u.closeModal(),setTimeout(()=>{t.$reset(),o.value.$reset()},300)}return(s,a)=>{const v=i("BaseIcon"),x=i("BaseInput"),_=i("BaseInputGroup"),M=i("BaseTextarea"),V=i("BaseInputGrid"),$=i("BaseButton"),S=i("BaseModal");return B(),b(S,{show:e(w),onClose:d},{header:r(()=>[m("div",A,[f(C(e(u).title)+" ",1),n(v,{name:"XIcon",class:"w-6 h-6 text-gray-500 cursor-pointer",onClick:d})])]),default:r(()=>[m("form",{action:"",onSubmit:U(I,["prevent"])},[m("div",X,[n(V,{layout:"one-column"},{default:r(()=>[n(_,{label:s.$t("expenses.category"),error:e(o).currentCategory.name.$error&&e(o).currentCategory.name.$errors[0].$message,required:""},{default:r(()=>[n(x,{modelValue:e(t).currentCategory.name,"onUpdate:modelValue":a[0]||(a[0]=l=>e(t).currentCategory.name=l),invalid:e(o).currentCategory.name.$error,type:"text",onInput:a[1]||(a[1]=l=>e(o).currentCategory.name.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["label","error"]),n(_,{label:s.$t("expenses.description"),error:e(o).currentCategory.description.$error&&e(o).currentCategory.description.$errors[0].$message},{default:r(()=>[n(M,{modelValue:e(t).currentCategory.description,"onUpdate:modelValue":a[2]||(a[2]=l=>e(t).currentCategory.description=l),rows:"4",cols:"50",onInput:a[3]||(a[3]=l=>e(o).currentCategory.description.$touch())},null,8,["modelValue"])]),_:1},8,["label","error"])]),_:1})]),m("div",F,[n($,{type:"button",variant:"primary-outline",class:"mr-3 text-sm",onClick:d},{default:r(()=>[f(C(s.$t("general.cancel")),1)]),_:1}),n($,{loading:e(c),disabled:e(c),variant:"primary",type:"submit"},{left:r(l=>[e(c)?G("",!0):(B(),b(v,{key:0,name:"SaveIcon",class:D(l.class)},null,8,["class"]))]),default:r(()=>[f(" "+C(e(t).isEdit?s.$t("general.update"):s.$t("general.save")),1)]),_:1},8,["loading","disabled"])])],40,J)]),_:1},8,["show"])}}};export{Q as _};
import{J as j,B as k,k as g,L as y,M as N,N as L,S as T,T as q,r as i,o as B,l as b,w as r,h as m,i as f,t as C,u as e,f as n,m as D,j as G,U}from"./vendor.01d0adc5.js";import{u as z}from"./category.4b37f0ed.js";import{c as E}from"./main.75722495.js";const A={class:"flex justify-between w-full"},J=["onSubmit"],X={class:"p-8 sm:p-6"},F={class:"z-0 flex justify-end p-4 border-t border-gray-200 border-solid border-modal-bg"},Q={setup(H){const t=z(),u=E(),{t:p}=j();let c=k(!1);const h=g(()=>({currentCategory:{name:{required:y.withMessage(p("validation.required"),N),minLength:y.withMessage(p("validation.name_min_length",{count:3}),L(3))},description:{maxLength:y.withMessage(p("validation.description_maxlength",{count:255}),T(255))}}})),o=q(h,g(()=>t)),w=g(()=>u.active&&u.componentName==="CategoryModal");async function I(){if(o.value.currentCategory.$touch(),o.value.currentCategory.$invalid)return!0;const s=t.isEdit?t.updateCategory:t.addCategory;c.value=!0,await s(t.currentCategory),c.value=!1,u.refreshData&&u.refreshData(),d()}function d(){u.closeModal(),setTimeout(()=>{t.$reset(),o.value.$reset()},300)}return(s,a)=>{const v=i("BaseIcon"),x=i("BaseInput"),_=i("BaseInputGroup"),M=i("BaseTextarea"),V=i("BaseInputGrid"),$=i("BaseButton"),S=i("BaseModal");return B(),b(S,{show:e(w),onClose:d},{header:r(()=>[m("div",A,[f(C(e(u).title)+" ",1),n(v,{name:"XIcon",class:"w-6 h-6 text-gray-500 cursor-pointer",onClick:d})])]),default:r(()=>[m("form",{action:"",onSubmit:U(I,["prevent"])},[m("div",X,[n(V,{layout:"one-column"},{default:r(()=>[n(_,{label:s.$t("expenses.category"),error:e(o).currentCategory.name.$error&&e(o).currentCategory.name.$errors[0].$message,required:""},{default:r(()=>[n(x,{modelValue:e(t).currentCategory.name,"onUpdate:modelValue":a[0]||(a[0]=l=>e(t).currentCategory.name=l),invalid:e(o).currentCategory.name.$error,type:"text",onInput:a[1]||(a[1]=l=>e(o).currentCategory.name.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["label","error"]),n(_,{label:s.$t("expenses.description"),error:e(o).currentCategory.description.$error&&e(o).currentCategory.description.$errors[0].$message},{default:r(()=>[n(M,{modelValue:e(t).currentCategory.description,"onUpdate:modelValue":a[2]||(a[2]=l=>e(t).currentCategory.description=l),rows:"4",cols:"50",onInput:a[3]||(a[3]=l=>e(o).currentCategory.description.$touch())},null,8,["modelValue"])]),_:1},8,["label","error"])]),_:1})]),m("div",F,[n($,{type:"button",variant:"primary-outline",class:"mr-3 text-sm",onClick:d},{default:r(()=>[f(C(s.$t("general.cancel")),1)]),_:1}),n($,{loading:e(c),disabled:e(c),variant:"primary",type:"submit"},{left:r(l=>[e(c)?G("",!0):(B(),b(v,{key:0,name:"SaveIcon",class:D(l.class)},null,8,["class"]))]),default:r(()=>[f(" "+C(e(t).isEdit?s.$t("general.update"):s.$t("general.save")),1)]),_:1},8,["loading","disabled"])])],40,J)]),_:1},8,["show"])}}};export{Q as _};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
var I=Object.defineProperty,b=Object.defineProperties;var g=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var f=(e,t,r)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t)=>{for(var r in t||(t={}))q.call(t,r)&&f(e,r,t[r]);if(y)for(var r of y(t))h.call(t,r)&&f(e,r,t[r]);return e},v=(e,t)=>b(e,g(t));import{J as j,L as w,O as V,T as L,k as T,aE as F,r as E,o as n,l as m,w as P,aj as O,u as c,_ as S,C as x,e as D,f as A,F as R,y as k,j as B,I as C}from"./vendor.d12b5734.js";import{o as i,m as Y}from"./main.465728e1.js";function $(e){switch(e){case"./types/DateTimeType.vue":return i(()=>import("./DateTimeType.6886ff98.js"),["assets/DateTimeType.6886ff98.js","assets/vendor.d12b5734.js"]);case"./types/DateType.vue":return i(()=>import("./DateType.12fc8765.js"),["assets/DateType.12fc8765.js","assets/vendor.d12b5734.js"]);case"./types/DropdownType.vue":return i(()=>import("./DropdownType.2d01b840.js"),["assets/DropdownType.2d01b840.js","assets/vendor.d12b5734.js"]);case"./types/InputType.vue":return i(()=>import("./InputType.cf0dfc7c.js"),["assets/InputType.cf0dfc7c.js","assets/vendor.d12b5734.js"]);case"./types/NumberType.vue":return i(()=>import("./NumberType.7b73360f.js"),["assets/NumberType.7b73360f.js","assets/vendor.d12b5734.js"]);case"./types/PhoneType.vue":return i(()=>import("./PhoneType.29ae66c8.js"),["assets/PhoneType.29ae66c8.js","assets/vendor.d12b5734.js"]);case"./types/SwitchType.vue":return i(()=>import("./SwitchType.591a8b07.js"),["assets/SwitchType.591a8b07.js","assets/vendor.d12b5734.js"]);case"./types/TextAreaType.vue":return i(()=>import("./TextAreaType.27565abe.js"),["assets/TextAreaType.27565abe.js","assets/vendor.d12b5734.js"]);case"./types/TimeType.vue":return i(()=>import("./TimeType.8ac8afd1.js"),["assets/TimeType.8ac8afd1.js","assets/vendor.d12b5734.js"]);case"./types/UrlType.vue":return i(()=>import("./UrlType.d123ab64.js"),["assets/UrlType.d123ab64.js","assets/vendor.d12b5734.js"]);default:return new Promise(function(t,r){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(r.bind(null,new Error("Unknown variable dynamic import: "+e)))})}}const M={props:{field:{type:Object,required:!0},customFieldScope:{type:String,required:!0},index:{type:Number,required:!0},store:{type:Object,required:!0},storeProp:{type:String,required:!0}},setup(e){const t=e,{t:r}=j(),d={value:{required:w.withMessage(r("validation.required"),V(t.field.is_required))}},a=L(d,T(()=>t.field),{$scope:t.customFieldScope}),o=T(()=>t.field.type?F(()=>$(`./types/${t.field.type}Type.vue`)):!1);return(u,s)=>{const l=E("BaseInputGroup");return n(),m(l,{label:e.field.label,required:!!e.field.is_required,error:c(a).value.$error&&c(a).value.$errors[0].$message},{default:P(()=>[(n(),m(O(c(o)),{modelValue:e.field.value,"onUpdate:modelValue":s[0]||(s[0]=p=>e.field.value=p),options:e.field.options,invalid:c(a).value.$error,placeholder:e.field.placeholder},null,8,["modelValue","options","invalid","placeholder"]))]),_:1},8,["label","required","error"])}}},N={key:0},J={props:{store:{type:Object,required:!0},storeProp:{type:String,required:!0},isEdit:{type:Boolean,default:!1},type:{type:String,default:null},gridLayout:{type:String,default:"two-column"},isLoading:{type:Boolean,default:null},customFieldScope:{type:String,required:!0}},setup(e){const t=e,r=Y();a();function d(){t.isEdit&&t.store[t.storeProp].fields.forEach(o=>{const u=t.store[t.storeProp].customFields.findIndex(s=>s.id===o.custom_field_id);if(u>-1){let s=o.default_answer;s&&o.custom_field.type==="DateTime"&&(s=C(o.default_answer,"YYYY-MM-DD HH:mm:ss").format("YYYY-MM-DD HH:mm")),t.store[t.storeProp].customFields[u]=v(_({},o),{id:o.custom_field_id,value:s,label:o.custom_field.label,options:o.custom_field.options,is_required:o.custom_field.is_required,placeholder:o.custom_field.placeholder,order:o.custom_field.order})}})}async function a(){let u=(await r.fetchCustomFields({type:t.type,limit:"all"})).data.data;u.map(s=>s.value=s.default_answer),t.store[t.storeProp].customFields=S.sortBy(u,s=>s.order),d()}return x(()=>t.store[t.storeProp].fields,o=>{d()}),(o,u)=>{const s=E("BaseInputGrid");return e.store[e.storeProp]&&e.store[e.storeProp].customFields.length>0&&!e.isLoading?(n(),D("div",N,[A(s,{layout:e.gridLayout},{default:P(()=>[(n(!0),D(R,null,k(e.store[e.storeProp].customFields,(l,p)=>(n(),m(M,{key:l.id,"custom-field-scope":e.customFieldScope,store:e.store,"store-prop":e.storeProp,index:p,field:l},null,8,["custom-field-scope","store","store-prop","index","field"]))),128))]),_:1},8,["layout"])])):B("",!0)}}};export{J as _};
var I=Object.defineProperty,g=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var _=(e,t,r)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,f=(e,t)=>{for(var r in t||(t={}))b.call(t,r)&&_(e,r,t[r]);if(y)for(var r of y(t))h.call(t,r)&&_(e,r,t[r]);return e},v=(e,t)=>g(e,q(t));import{J as j,L as w,O as V,T as L,k as T,aE as F,r as E,o as n,l as m,w as P,aj as O,u as c,_ as S,C as x,e as D,f as A,F as R,y as k,j as B,I as C}from"./vendor.01d0adc5.js";import{o as i,m as Y}from"./main.75722495.js";function $(e){switch(e){case"./types/DateTimeType.vue":return i(()=>import("./DateTimeType.164ef007.js"),["assets/DateTimeType.164ef007.js","assets/vendor.01d0adc5.js"]);case"./types/DateType.vue":return i(()=>import("./DateType.757171f6.js"),["assets/DateType.757171f6.js","assets/vendor.01d0adc5.js"]);case"./types/DropdownType.vue":return i(()=>import("./DropdownType.631322dc.js"),["assets/DropdownType.631322dc.js","assets/vendor.01d0adc5.js"]);case"./types/InputType.vue":return i(()=>import("./InputType.4e1e4da6.js"),["assets/InputType.4e1e4da6.js","assets/vendor.01d0adc5.js"]);case"./types/NumberType.vue":return i(()=>import("./NumberType.137b13f5.js"),["assets/NumberType.137b13f5.js","assets/vendor.01d0adc5.js"]);case"./types/PhoneType.vue":return i(()=>import("./PhoneType.57e436b9.js"),["assets/PhoneType.57e436b9.js","assets/vendor.01d0adc5.js"]);case"./types/SwitchType.vue":return i(()=>import("./SwitchType.59d9fde0.js"),["assets/SwitchType.59d9fde0.js","assets/vendor.01d0adc5.js"]);case"./types/TextAreaType.vue":return i(()=>import("./TextAreaType.ebc60805.js"),["assets/TextAreaType.ebc60805.js","assets/vendor.01d0adc5.js"]);case"./types/TimeType.vue":return i(()=>import("./TimeType.a6077fcb.js"),["assets/TimeType.a6077fcb.js","assets/vendor.01d0adc5.js"]);case"./types/UrlType.vue":return i(()=>import("./UrlType.4a23df64.js"),["assets/UrlType.4a23df64.js","assets/vendor.01d0adc5.js"]);default:return new Promise(function(t,r){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(r.bind(null,new Error("Unknown variable dynamic import: "+e)))})}}const M={props:{field:{type:Object,required:!0},customFieldScope:{type:String,required:!0},index:{type:Number,required:!0},store:{type:Object,required:!0},storeProp:{type:String,required:!0}},setup(e){const t=e,{t:r}=j(),d={value:{required:w.withMessage(r("validation.required"),V(t.field.is_required))}},a=L(d,T(()=>t.field),{$scope:t.customFieldScope}),o=T(()=>t.field.type?F(()=>$(`./types/${t.field.type}Type.vue`)):!1);return(u,s)=>{const l=E("BaseInputGroup");return n(),m(l,{label:e.field.label,required:!!e.field.is_required,error:c(a).value.$error&&c(a).value.$errors[0].$message},{default:P(()=>[(n(),m(O(c(o)),{modelValue:e.field.value,"onUpdate:modelValue":s[0]||(s[0]=p=>e.field.value=p),options:e.field.options,invalid:c(a).value.$error,placeholder:e.field.placeholder},null,8,["modelValue","options","invalid","placeholder"]))]),_:1},8,["label","required","error"])}}},N={key:0},J={props:{store:{type:Object,required:!0},storeProp:{type:String,required:!0},isEdit:{type:Boolean,default:!1},type:{type:String,default:null},gridLayout:{type:String,default:"two-column"},isLoading:{type:Boolean,default:null},customFieldScope:{type:String,required:!0}},setup(e){const t=e,r=Y();a();function d(){t.isEdit&&t.store[t.storeProp].fields.forEach(o=>{const u=t.store[t.storeProp].customFields.findIndex(s=>s.id===o.custom_field_id);if(u>-1){let s=o.default_answer;s&&o.custom_field.type==="DateTime"&&(s=C(o.default_answer,"YYYY-MM-DD HH:mm:ss").format("YYYY-MM-DD HH:mm")),t.store[t.storeProp].customFields[u]=v(f({},o),{id:o.custom_field_id,value:s,label:o.custom_field.label,options:o.custom_field.options,is_required:o.custom_field.is_required,placeholder:o.custom_field.placeholder,order:o.custom_field.order})}})}async function a(){let u=(await r.fetchCustomFields({type:t.type,limit:"all"})).data.data;u.map(s=>s.value=s.default_answer),t.store[t.storeProp].customFields=S.sortBy(u,s=>s.order),d()}return x(()=>t.store[t.storeProp].fields,o=>{d()}),(o,u)=>{const s=E("BaseInputGrid");return e.store[e.storeProp]&&e.store[e.storeProp].customFields.length>0&&!e.isLoading?(n(),D("div",N,[A(s,{layout:e.gridLayout},{default:P(()=>[(n(!0),D(R,null,k(e.store[e.storeProp].customFields,(l,p)=>(n(),m(M,{key:l.id,"custom-field-scope":e.customFieldScope,store:e.store,"store-prop":e.storeProp,index:p,field:l},null,8,["custom-field-scope","store","store-prop","index","field"]))),128))]),_:1},8,["layout"])])):B("",!0)}}};export{J as _};

View File

@ -1 +1 @@
import{l as S,u as b,j as C,e as x,g}from"./main.465728e1.js";import{J as E,G as j,aN as T,ah as N,r as l,o as a,l as s,w as t,u as e,f as n,i as p,t as f,j as y}from"./vendor.d12b5734.js";const V={props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:()=>{}}},setup(i){const w=i,_=S();b();const v=C(),m=x(),{t:u}=E(),h=j();T(),N("utils");function B(r){v.openDialog({title:u("general.are_you_sure"),message:u("customers.confirm_delete",1),yesLabel:u("general.ok"),noLabel:u("general.cancel"),variant:"danger",hideNoButton:!1,size:"lg"}).then(c=>{c&&_.deleteCustomer({ids:[r]}).then(o=>{if(o.data.success)return w.loadData&&w.loadData(),!0})})}return(r,c)=>{const o=l("BaseIcon"),I=l("BaseButton"),d=l("BaseDropdownItem"),D=l("router-link"),k=l("BaseDropdown");return a(),s(k,{"content-loading":e(_).isFetchingViewData},{activator:t(()=>[e(h).name==="customers.view"?(a(),s(I,{key:0,variant:"primary"},{default:t(()=>[n(o,{name:"DotsHorizontalIcon",class:"h-5 text-white"})]),_:1})):(a(),s(o,{key:1,name:"DotsHorizontalIcon",class:"h-5 text-gray-500"}))]),default:t(()=>[e(m).hasAbilities(e(g).EDIT_CUSTOMER)?(a(),s(D,{key:0,to:`/admin/customers/${i.row.id}/edit`},{default:t(()=>[n(d,null,{default:t(()=>[n(o,{name:"PencilIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),p(" "+f(r.$t("general.edit")),1)]),_:1})]),_:1},8,["to"])):y("",!0),e(h).name!=="customers.view"&&e(m).hasAbilities(e(g).VIEW_CUSTOMER)?(a(),s(D,{key:1,to:`customers/${i.row.id}/view`},{default:t(()=>[n(d,null,{default:t(()=>[n(o,{name:"EyeIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),p(" "+f(r.$t("general.view")),1)]),_:1})]),_:1},8,["to"])):y("",!0),e(m).hasAbilities(e(g).DELETE_CUSTOMER)?(a(),s(d,{key:2,onClick:c[0]||(c[0]=$=>B(i.row.id))},{default:t(()=>[n(o,{name:"TrashIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),p(" "+f(r.$t("general.delete")),1)]),_:1})):y("",!0)]),_:1},8,["content-loading"])}}};export{V as _};
import{l as S,u as C,j as b,e as x,g}from"./main.75722495.js";import{J as E,G as j,aN as T,ah as N,r as l,o as a,l as s,w as t,u as e,f as n,i as p,t as f,j as y}from"./vendor.01d0adc5.js";const V={props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:()=>{}}},setup(i){const w=i,_=S();C();const v=b(),m=x(),{t:u}=E(),h=j();T(),N("utils");function B(r){v.openDialog({title:u("general.are_you_sure"),message:u("customers.confirm_delete",1),yesLabel:u("general.ok"),noLabel:u("general.cancel"),variant:"danger",hideNoButton:!1,size:"lg"}).then(c=>{c&&_.deleteCustomer({ids:[r]}).then(o=>{if(o.data.success)return w.loadData&&w.loadData(),!0})})}return(r,c)=>{const o=l("BaseIcon"),I=l("BaseButton"),d=l("BaseDropdownItem"),D=l("router-link"),k=l("BaseDropdown");return a(),s(k,{"content-loading":e(_).isFetchingViewData},{activator:t(()=>[e(h).name==="customers.view"?(a(),s(I,{key:0,variant:"primary"},{default:t(()=>[n(o,{name:"DotsHorizontalIcon",class:"h-5 text-white"})]),_:1})):(a(),s(o,{key:1,name:"DotsHorizontalIcon",class:"h-5 text-gray-500"}))]),default:t(()=>[e(m).hasAbilities(e(g).EDIT_CUSTOMER)?(a(),s(D,{key:0,to:`/admin/customers/${i.row.id}/edit`},{default:t(()=>[n(d,null,{default:t(()=>[n(o,{name:"PencilIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),p(" "+f(r.$t("general.edit")),1)]),_:1})]),_:1},8,["to"])):y("",!0),e(h).name!=="customers.view"&&e(m).hasAbilities(e(g).VIEW_CUSTOMER)?(a(),s(D,{key:1,to:`customers/${i.row.id}/view`},{default:t(()=>[n(d,null,{default:t(()=>[n(o,{name:"EyeIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),p(" "+f(r.$t("general.view")),1)]),_:1})]),_:1},8,["to"])):y("",!0),e(m).hasAbilities(e(g).DELETE_CUSTOMER)?(a(),s(d,{key:2,onClick:c[0]||(c[0]=$=>B(i.row.id))},{default:t(()=>[n(o,{name:"TrashIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),p(" "+f(r.$t("general.delete")),1)]),_:1})):y("",!0)]),_:1},8,["content-loading"])}}};export{V as _};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{I as r,k as d,r as m,o as p,l as c,u as i,x as f}from"./vendor.d12b5734.js";const k={props:{modelValue:{type:String,default:r().format("YYYY-MM-DD hh:MM")}},emits:["update:modelValue"],setup(t,{emit:l}){const s=t,e=d({get:()=>s.modelValue,set:o=>{l("update:modelValue",o)}});return(o,a)=>{const u=m("BaseDatePicker");return p(),c(u,{modelValue:i(e),"onUpdate:modelValue":a[0]||(a[0]=n=>f(e)?e.value=n:null),"enable-time":""},null,8,["modelValue"])}}};export{k as default};
import{I as r,k as d,r as m,o as p,l as c,u as i,x as f}from"./vendor.01d0adc5.js";const k={props:{modelValue:{type:String,default:r().format("YYYY-MM-DD hh:MM")}},emits:["update:modelValue"],setup(t,{emit:l}){const s=t,e=d({get:()=>s.modelValue,set:o=>{l("update:modelValue",o)}});return(o,a)=>{const u=m("BaseDatePicker");return p(),c(u,{modelValue:i(e),"onUpdate:modelValue":a[0]||(a[0]=n=>f(e)?e.value=n:null),"enable-time":""},null,8,["modelValue"])}}};export{k as default};

View File

@ -1 +1 @@
import{I as r,k as d,r as m,o as p,l as c,u as f,x as i}from"./vendor.d12b5734.js";const k={props:{modelValue:{type:[String,Date],default:r().format("YYYY-MM-DD")}},emits:["update:modelValue"],setup(t,{emit:l}){const s=t,e=d({get:()=>s.modelValue,set:o=>{l("update:modelValue",o)}});return(o,a)=>{const u=m("BaseDatePicker");return p(),c(u,{modelValue:f(e),"onUpdate:modelValue":a[0]||(a[0]=n=>i(e)?e.value=n:null)},null,8,["modelValue"])}}};export{k as default};
import{I as r,k as d,r as m,o as p,l as c,u as f,x as i}from"./vendor.01d0adc5.js";const k={props:{modelValue:{type:[String,Date],default:r().format("YYYY-MM-DD")}},emits:["update:modelValue"],setup(t,{emit:l}){const s=t,e=d({get:()=>s.modelValue,set:o=>{l("update:modelValue",o)}});return(o,a)=>{const u=m("BaseDatePicker");return p(),c(u,{modelValue:f(e),"onUpdate:modelValue":a[0]||(a[0]=n=>i(e)?e.value=n:null)},null,8,["modelValue"])}}};export{k as default};

View File

@ -1,4 +1,4 @@
import{aU as $r,aV as Br,aQ as Kr,aW as Hr,o as Wr,e as Xr,h as Yr}from"./vendor.d12b5734.js";import{_ as Vr}from"./main.465728e1.js";var gr={exports:{}};/**!
import{aU as $r,aV as Br,aQ as Kr,aW as Hr,o as Wr,e as Xr,h as Yr}from"./vendor.01d0adc5.js";import{_ as Vr}from"./main.75722495.js";var gr={exports:{}};/**!
* Sortable 1.14.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>

View File

@ -1 +0,0 @@
import{k as p,r,o as d,l as m,u as c,x as i}from"./vendor.d12b5734.js";const f={props:{modelValue:{type:[String,Object,Number],default:null},options:{type:Array,default:()=>[]},valueProp:{type:String,default:"name"},label:{type:String,default:"name"},object:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:a}){const u=e,l=p({get:()=>u.modelValue,set:t=>{a("update:modelValue",t)}});return(t,o)=>{const n=r("BaseMultiselect");return d(),m(n,{modelValue:c(l),"onUpdate:modelValue":o[0]||(o[0]=s=>i(l)?l.value=s:null),options:e.options,label:e.label,"value-prop":e.valueProp,object:e.object},null,8,["modelValue","options","label","value-prop","object"])}}};export{f as default};

View File

@ -0,0 +1 @@
import{k as p,r as d,o as r,l as c,u as m,x as i}from"./vendor.01d0adc5.js";const b={props:{modelValue:{type:[String,Object,Number],default:null},options:{type:Array,default:()=>[]},valueProp:{type:String,default:"name"},label:{type:String,default:"name"},object:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:o}){const u=e,l=p({get:()=>u.modelValue,set:t=>{o("update:modelValue",t)}});return(t,a)=>{const n=d("BaseMultiselect");return r(),c(n,{modelValue:m(l),"onUpdate:modelValue":a[0]||(a[0]=s=>i(l)?l.value=s:null),options:e.options,label:e.label,"value-prop":e.valueProp,object:e.object},null,8,["modelValue","options","label","value-prop","object"])}}};export{b as default};

Some files were not shown because too many files have changed in this diff Show More