Compare commits
9 Commits
dev
...
temp/servi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5319af831 | ||
|
|
f9d2e95e5a | ||
|
|
9f80956145 | ||
|
|
83031218ea | ||
|
|
9c3f2bbd78 | ||
|
|
01111a6f0b | ||
|
|
030a630681 | ||
|
|
5ee420dde6 | ||
|
|
8f80ed5446 |
@ -16,7 +16,7 @@ generates:
|
||||
object: true
|
||||
defaultValue: true
|
||||
scalars:
|
||||
Uuid: string
|
||||
UUID: string
|
||||
Decimal: number
|
||||
DateTime: string
|
||||
# exclude: './graphql/crm.schema.graphql'
|
||||
|
||||
@ -4,7 +4,7 @@ import type { Row } from '../types';
|
||||
import type { RequestEltKasko, RequestEltOsago } from '@/api/elt/types';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import dayjs from 'dayjs';
|
||||
import { first, sort } from 'radash';
|
||||
|
||||
@ -12,7 +12,7 @@ export async function makeOwnOsagoRequest(
|
||||
{ store, apolloClient }: Pick<ProcessContext, 'apolloClient' | 'store'>,
|
||||
row: Row
|
||||
): Promise<NonNullable<CRMTypes.GetOsagoAddproductTypesQuery['evo_addproduct_types']>[number]> {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const {
|
||||
data: { evo_addproduct_types },
|
||||
|
||||
@ -8,7 +8,7 @@ query GetTransactionCurrencies {
|
||||
}
|
||||
}
|
||||
|
||||
query GetTransactionCurrency($currencyid: Uuid!) {
|
||||
query GetTransactionCurrency($currencyid: UUID!) {
|
||||
transactioncurrency(transactioncurrencyid: $currencyid) {
|
||||
currencysymbol
|
||||
isocurrencycode
|
||||
@ -17,20 +17,33 @@ query GetTransactionCurrency($currencyid: Uuid!) {
|
||||
}
|
||||
|
||||
query GetCurrencyChanges($currentDate: DateTime) {
|
||||
evo_currencychanges(statecode: 0, evo_coursedate_param: { eq: $currentDate }) {
|
||||
evo_currencychanges(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_coursedate", eq: $currentDate } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
evo_currencychange
|
||||
evo_ref_transactioncurrency
|
||||
}
|
||||
}
|
||||
|
||||
query GetLeads($domainname: String) {
|
||||
leads(owner_domainname: $domainname) {
|
||||
label: fullname
|
||||
value: leadid
|
||||
systemusers(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: { filterConditionString: { fieldName: "domainname", eq: $domainname } }
|
||||
}
|
||||
) {
|
||||
leads {
|
||||
label: fullname
|
||||
value: leadid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query GetLead($leadid: Uuid!) {
|
||||
query GetLead($leadid: UUID!) {
|
||||
lead(leadid: $leadid) {
|
||||
evo_agent_accountid
|
||||
evo_double_agent_accountid
|
||||
@ -52,7 +65,7 @@ query GetLead($leadid: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetOpportunity($opportunityid: Uuid!) {
|
||||
query GetOpportunity($opportunityid: UUID!) {
|
||||
opportunity(opportunityid: $opportunityid) {
|
||||
evo_leadid
|
||||
accountidData {
|
||||
@ -67,14 +80,28 @@ query GetOpportunity($opportunityid: Uuid!) {
|
||||
}
|
||||
|
||||
query GetOpportunities($domainname: String) {
|
||||
opportunities(owner_domainname: $domainname) {
|
||||
label: name
|
||||
value: opportunityid
|
||||
systemusers(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: { filterConditionString: { fieldName: "domainname", eq: $domainname } }
|
||||
}
|
||||
) {
|
||||
opportunities {
|
||||
label: name
|
||||
value: opportunityid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query GetQuotes($leadid: Uuid!) {
|
||||
quotes(evo_leadid: $leadid) {
|
||||
query GetQuotes($leadid: UUID!) {
|
||||
quotes(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionGuid: { fieldName: "evo_leadid", eq: $leadid } }
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
]
|
||||
}
|
||||
orderby: { fieldName: "createdon", sortingType: DESC }
|
||||
) {
|
||||
label: evo_quotename
|
||||
value: quoteid
|
||||
evo_recalc_limit
|
||||
@ -85,8 +112,8 @@ query GetQuotes($leadid: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetQuote($quoteId: Uuid!) {
|
||||
quote(quoteId: $quoteId) {
|
||||
query GetQuote($quoteId: UUID!) {
|
||||
quote(quoteid: $quoteId) {
|
||||
evo_baseproductid
|
||||
evo_one_year_insurance
|
||||
evo_min_change_price
|
||||
@ -113,8 +140,8 @@ query GetQuote($quoteId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetQuoteData($quoteId: Uuid!) {
|
||||
quote(quoteId: $quoteId) {
|
||||
query GetQuoteData($quoteId: UUID!) {
|
||||
quote(quoteid: $quoteId) {
|
||||
evo_addproduct_types {
|
||||
evo_product_type
|
||||
evo_addproduct_typeid
|
||||
@ -268,9 +295,13 @@ query GetQuoteData($quoteId: Uuid!) {
|
||||
|
||||
query GetTarifs($currentDate: DateTime) {
|
||||
evo_tarifs(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_tarifid
|
||||
@ -293,7 +324,7 @@ query GetTarifs($currentDate: DateTime) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetTarif($tarifId: Uuid!) {
|
||||
query GetTarif($tarifId: UUID!) {
|
||||
evo_tarif(evo_tarifid: $tarifId) {
|
||||
label: evo_name
|
||||
value: evo_tarifid
|
||||
@ -316,9 +347,13 @@ query GetTarif($tarifId: Uuid!) {
|
||||
|
||||
query GetRates($currentDate: DateTime) {
|
||||
evo_rates(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_rateid
|
||||
@ -330,7 +365,7 @@ query GetRates($currentDate: DateTime) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetRate($rateId: Uuid!) {
|
||||
query GetRate($rateId: UUID!) {
|
||||
evo_rate(evo_rateid: $rateId) {
|
||||
evo_base_rate
|
||||
evo_credit_period
|
||||
@ -341,10 +376,14 @@ query GetRate($rateId: Uuid!) {
|
||||
|
||||
query GetProducts($currentDate: DateTime) {
|
||||
evo_baseproducts(
|
||||
statecode: 0
|
||||
evo_relation: [100000000]
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionMultyPicklist: { fieldName: "evo_relation", oneof: [100000000] } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_baseproductid
|
||||
@ -355,7 +394,7 @@ query GetProducts($currentDate: DateTime) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetProduct($productId: Uuid!) {
|
||||
query GetProduct($productId: UUID!) {
|
||||
evo_baseproduct(evo_baseproductid: $productId) {
|
||||
evo_leasingobject_types {
|
||||
evo_leasingobject_typeid
|
||||
@ -381,9 +420,13 @@ query GetProduct($productId: Uuid!) {
|
||||
|
||||
query GetSubsidies($currentDate: DateTime) {
|
||||
evo_subsidies(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_subsidyid
|
||||
@ -391,7 +434,7 @@ query GetSubsidies($currentDate: DateTime) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetSubsidy($subsidyId: Uuid!) {
|
||||
query GetSubsidy($subsidyId: UUID!) {
|
||||
evo_subsidy(evo_subsidyid: $subsidyId) {
|
||||
evo_leasingobject_types {
|
||||
evo_leasingobject_typeid
|
||||
@ -413,7 +456,7 @@ query GetSubsidy($subsidyId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetImportProgram($importProgramId: Uuid!) {
|
||||
query GetImportProgram($importProgramId: UUID!) {
|
||||
importProgram: evo_subsidy(evo_subsidyid: $importProgramId) {
|
||||
evo_leasingobject_types {
|
||||
evo_leasingobject_typeid
|
||||
@ -431,7 +474,7 @@ query GetImportProgram($importProgramId: Uuid!) {
|
||||
}
|
||||
|
||||
query GetRegions {
|
||||
evo_regions {
|
||||
evo_regions(orderby: { fieldName: "evo_name", sortingType: ASC }) {
|
||||
label: evo_name
|
||||
value: evo_regionid
|
||||
evo_fias_id
|
||||
@ -439,7 +482,7 @@ query GetRegions {
|
||||
}
|
||||
}
|
||||
|
||||
query GetRegion($regionId: Uuid!) {
|
||||
query GetRegion($regionId: UUID!) {
|
||||
evo_region(evo_regionid: $regionId) {
|
||||
evo_oktmo
|
||||
accounts {
|
||||
@ -449,8 +492,16 @@ query GetRegion($regionId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetTowns($regionId: Uuid!) {
|
||||
evo_towns(evo_regionid: $regionId) {
|
||||
query GetTowns($regionId: UUID!) {
|
||||
evo_towns(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionGuid: { fieldName: "evo_regionid", eq: $regionId } }
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
]
|
||||
}
|
||||
orderby: { fieldName: "evo_name", sortingType: ASC }
|
||||
) {
|
||||
evo_fias_id
|
||||
label: evo_name
|
||||
value: evo_townid
|
||||
@ -458,22 +509,33 @@ query GetTowns($regionId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetTown($townId: Uuid!) {
|
||||
query GetTown($townId: UUID!) {
|
||||
evo_town(evo_townid: $townId) {
|
||||
evo_kladr_id
|
||||
}
|
||||
}
|
||||
|
||||
query GetGPSBrands {
|
||||
evo_gps_brands(statecode: 0) {
|
||||
evo_gps_brands(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: { filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_gps_brandid
|
||||
evo_id
|
||||
}
|
||||
}
|
||||
|
||||
query GetGPSModels($gpsBrandId: Uuid!) {
|
||||
evo_gps_models(evo_gps_brandid: $gpsBrandId) {
|
||||
query GetGPSModels($gpsBrandId: UUID!) {
|
||||
evo_gps_models(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionGuid: { fieldName: "evo_gps_brandid", eq: $gpsBrandId } }
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_gps_modelid
|
||||
evo_id
|
||||
@ -481,14 +543,18 @@ query GetGPSModels($gpsBrandId: Uuid!) {
|
||||
}
|
||||
|
||||
query GetLeaseObjectTypes {
|
||||
evo_leasingobject_types(statecode: 0) {
|
||||
evo_leasingobject_types(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: { filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_leasingobject_typeid
|
||||
evo_leasingobject_typeid
|
||||
}
|
||||
}
|
||||
|
||||
query GetLeaseObjectType($leaseObjectTypeId: Uuid!) {
|
||||
query GetLeaseObjectType($leaseObjectTypeId: UUID!) {
|
||||
evo_leasingobject_type(evo_leasingobject_typeid: $leaseObjectTypeId) {
|
||||
evo_vehicle_type
|
||||
evo_id
|
||||
@ -508,7 +574,12 @@ query GetLeaseObjectType($leaseObjectTypeId: Uuid!) {
|
||||
}
|
||||
|
||||
query GetBrands {
|
||||
evo_brands(statecode: 0) {
|
||||
evo_brands(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: { filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
}
|
||||
orderby: { fieldName: "evo_name", sortingType: ASC }
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_brandid
|
||||
evo_brandid
|
||||
@ -516,7 +587,7 @@ query GetBrands {
|
||||
}
|
||||
}
|
||||
|
||||
query GetBrand($brandId: Uuid!) {
|
||||
query GetBrand($brandId: UUID!) {
|
||||
evo_brand(evo_brandid: $brandId) {
|
||||
evo_id
|
||||
evo_importer_reward_perc
|
||||
@ -526,8 +597,16 @@ query GetBrand($brandId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetModels($brandId: Uuid!) {
|
||||
evo_models(statecode: 0, evo_brandid: $brandId) {
|
||||
query GetModels($brandId: UUID!) {
|
||||
evo_models(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionGuid: { fieldName: "evo_brandid", eq: $brandId } }
|
||||
]
|
||||
}
|
||||
orderby: { fieldName: "evo_name", sortingType: ASC }
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_modelid
|
||||
evo_modelid
|
||||
@ -537,7 +616,7 @@ query GetModels($brandId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetModel($modelId: Uuid!) {
|
||||
query GetModel($modelId: UUID!) {
|
||||
evo_model(evo_modelid: $modelId) {
|
||||
evo_impairment_groupidData {
|
||||
evo_name
|
||||
@ -554,15 +633,22 @@ query GetModel($modelId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetConfigurations($modelId: Uuid!) {
|
||||
evo_equipments(statecode: 0, evo_modelid: $modelId) {
|
||||
query GetConfigurations($modelId: UUID!) {
|
||||
evo_equipments(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionGuid: { fieldName: "evo_modelid", eq: $modelId } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_equipmentid
|
||||
evo_start_production_year
|
||||
}
|
||||
}
|
||||
|
||||
query GetConfiguration($configurationId: Uuid!) {
|
||||
query GetConfiguration($configurationId: UUID!) {
|
||||
evo_equipment(evo_equipmentid: $configurationId) {
|
||||
evo_impairment_groupidData {
|
||||
evo_name
|
||||
@ -571,7 +657,16 @@ query GetConfiguration($configurationId: Uuid!) {
|
||||
}
|
||||
|
||||
query GetDealers {
|
||||
dealers: accounts(evo_account_type: [100000001], statecode: 0, evo_legal_form: 100000001) {
|
||||
dealers: accounts(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionMultyPicklist: { fieldName: "evo_account_type", oneof: [100000001] } }
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionInt: { fieldName: "evo_legal_form", eq: 100000001 } }
|
||||
]
|
||||
}
|
||||
orderby: { fieldName: "name", sortingType: ASC }
|
||||
) {
|
||||
label: name
|
||||
value: accountid
|
||||
accountid
|
||||
@ -579,7 +674,7 @@ query GetDealers {
|
||||
}
|
||||
}
|
||||
|
||||
query GetDealer($dealerId: Uuid!) {
|
||||
query GetDealer($dealerId: UUID!) {
|
||||
dealer: account(accountid: $dealerId) {
|
||||
evo_return_leasing_dealer
|
||||
evo_broker_accountid
|
||||
@ -587,8 +682,8 @@ query GetDealer($dealerId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetDealerPersons($dealerId: Uuid!) {
|
||||
dealerPersons: salon_providers(statecode: 0, salonaccountid: $dealerId) {
|
||||
query GetDealerPersons($dealerId: UUID!) {
|
||||
dealerPersons: salon_providers(salonaccountid: $dealerId) {
|
||||
label: name
|
||||
value: accountid
|
||||
accountid
|
||||
@ -598,27 +693,40 @@ query GetDealerPersons($dealerId: Uuid!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetDealerPerson($dealerPersonId: Uuid!) {
|
||||
query GetDealerPerson($dealerPersonId: UUID!) {
|
||||
account(accountid: $dealerPersonId) {
|
||||
evo_supplier_type
|
||||
evo_supplier_financing_accept
|
||||
}
|
||||
}
|
||||
|
||||
query GetAgent($agentid: Uuid!) {
|
||||
query GetAgent($agentid: UUID!) {
|
||||
agent: account(accountid: $agentid) {
|
||||
label: name
|
||||
value: accountid
|
||||
}
|
||||
}
|
||||
|
||||
query GetRewardConditions($agentid: Uuid!, $currentDate: DateTime) {
|
||||
query GetRewardConditions($agentid: UUID!, $currentDate: DateTime) {
|
||||
evo_reward_conditions(
|
||||
evo_agent_accountid: $agentid
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
statecode: 0
|
||||
evo_agency_agreementid_param: { has: true }
|
||||
filterConditionGroup: {
|
||||
andFilterConditionGroup: [
|
||||
{
|
||||
orFilterConditions: [
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", eq: null } }
|
||||
]
|
||||
}
|
||||
{
|
||||
andFilterConditions: [
|
||||
{ filterConditionGuid: { fieldName: "evo_agent_accountid", eq: $agentid } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionGuid: { fieldName: "evo_agency_agreementid", neq: null } }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_reward_conditionid
|
||||
@ -627,7 +735,7 @@ query GetRewardConditions($agentid: Uuid!, $currentDate: DateTime) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetRewardCondition($conditionId: Uuid!) {
|
||||
query GetRewardCondition($conditionId: UUID!) {
|
||||
evo_reward_condition(evo_reward_conditionid: $conditionId) {
|
||||
evo_reward_summ
|
||||
evo_reduce_reward
|
||||
@ -642,16 +750,27 @@ query GetRewardCondition($conditionId: Uuid!) {
|
||||
}
|
||||
|
||||
query GetSotCoefficientType($evo_id: String) {
|
||||
evo_sot_coefficient_type(evo_id: $evo_id) {
|
||||
evo_sot_coefficient_types(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionString: { fieldName: "evo_id", eq: $evo_id } }
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
evo_sot_coefficient_typeid
|
||||
}
|
||||
}
|
||||
|
||||
query GetCoefficients($currentDate: DateTime) {
|
||||
evo_coefficients(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
evo_job_titleid
|
||||
evo_sot_coefficient_typeid
|
||||
@ -677,7 +796,11 @@ query GetCoefficients($currentDate: DateTime) {
|
||||
}
|
||||
|
||||
query GetSystemUser($domainname: String) {
|
||||
systemuser(domainname: $domainname) {
|
||||
systemusers(
|
||||
filterConditionGroup: {
|
||||
filterCondition: { filterConditionString: { fieldName: "domainname", eq: $domainname } }
|
||||
}
|
||||
) {
|
||||
evo_job_titleid
|
||||
businessunitid
|
||||
roles {
|
||||
@ -695,9 +818,13 @@ fragment CoreAddProductTypesFields on evo_addproduct_type {
|
||||
|
||||
query GetAddproductTypes($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
...CoreAddProductTypesFields
|
||||
evo_product_type
|
||||
@ -711,7 +838,7 @@ query GetAddproductTypes($currentDate: DateTime) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetAddProductType($addproductTypeId: Uuid!) {
|
||||
query GetAddProductType($addproductTypeId: UUID!) {
|
||||
evo_addproduct_type(evo_addproduct_typeid: $addproductTypeId) {
|
||||
evo_description
|
||||
evo_helpcard_type
|
||||
@ -735,10 +862,14 @@ query GetAddProductType($addproductTypeId: Uuid!) {
|
||||
|
||||
query GetRegistrationTypes($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
evo_product_type: 100000001
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "evo_product_type", eq: 100000001 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
...CoreAddProductTypesFields
|
||||
evo_leasingobject_types {
|
||||
@ -754,10 +885,14 @@ query GetRegistrationTypes($currentDate: DateTime) {
|
||||
|
||||
query GetTechnicalCards($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
evo_product_type: 100000000
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "evo_product_type", eq: 100000000 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
...CoreAddProductTypesFields
|
||||
evo_min_period
|
||||
@ -771,10 +906,14 @@ query GetTechnicalCards($currentDate: DateTime) {
|
||||
|
||||
query GetFuelCards($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
evo_product_type: 100000005
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "evo_product_type", eq: 100000005 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
...CoreAddProductTypesFields
|
||||
evo_min_period
|
||||
@ -787,10 +926,14 @@ query GetFuelCards($currentDate: DateTime) {
|
||||
|
||||
query GetTelematicTypes($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
evo_product_type: 100000004
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "evo_product_type", eq: 100000004 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
...CoreAddProductTypesFields
|
||||
evo_controls_program
|
||||
@ -800,10 +943,14 @@ query GetTelematicTypes($currentDate: DateTime) {
|
||||
|
||||
query GetTrackerTypes($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
evo_product_type: 100000003
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "evo_product_type", eq: 100000003 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
...CoreAddProductTypesFields
|
||||
evo_controls_program
|
||||
@ -813,10 +960,14 @@ query GetTrackerTypes($currentDate: DateTime) {
|
||||
|
||||
query GetInsNSIBTypes($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
evo_product_type: 100000002
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "evo_product_type", eq: 100000002 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
...CoreAddProductTypesFields
|
||||
evo_max_period
|
||||
@ -834,10 +985,14 @@ query GetInsNSIBTypes($currentDate: DateTime) {
|
||||
|
||||
query GetLeasingWithoutKaskoTypes($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_product_type: 100000007
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "evo_product_type", eq: 100000007 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
...CoreAddProductTypesFields
|
||||
evo_product_type
|
||||
@ -859,10 +1014,14 @@ query GetLeasingWithoutKaskoTypes($currentDate: DateTime) {
|
||||
|
||||
query GetOsagoAddproductTypes($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_product_type: 100000008
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
{ filterConditionInt: { fieldName: "evo_product_type", eq: 100000008 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
evo_product_type
|
||||
evo_visible_calc
|
||||
@ -880,7 +1039,7 @@ query GetOsagoAddproductTypes($currentDate: DateTime) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetInsuranceCompany($accountId: Uuid!) {
|
||||
query GetInsuranceCompany($accountId: UUID!) {
|
||||
account(accountid: $accountId) {
|
||||
evo_osago_with_kasko
|
||||
evo_legal_region_calc
|
||||
@ -889,7 +1048,14 @@ query GetInsuranceCompany($accountId: Uuid!) {
|
||||
}
|
||||
|
||||
query GetInsuranceCompanies {
|
||||
accounts(evo_account_type: [100000002], statecode: 0) {
|
||||
accounts(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionMultyPicklist: { fieldName: "evo_account_type", oneof: [100000002] } }
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
evo_type_ins_policy
|
||||
evo_evokasko_access
|
||||
evo_inn
|
||||
@ -903,7 +1069,11 @@ query GetInsuranceCompanies {
|
||||
}
|
||||
|
||||
query GetRoles($roleName: String) {
|
||||
roles(name: $roleName) {
|
||||
roles(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: { filterConditionString: { fieldName: "name", eq: $roleName } }
|
||||
}
|
||||
) {
|
||||
systemusers {
|
||||
label: fullname
|
||||
value: domainname
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,14 @@
|
||||
import type * as CRMTypes from '@/graphql/crm.types';
|
||||
|
||||
function evo_baseproducts(evo_baseproducts: CRMTypes.GetProductsQuery['evo_baseproducts']) {
|
||||
type SystemUser = NonNullable<CRMTypes.GetSystemUserQuery['systemusers']>[number];
|
||||
|
||||
function evo_baseproducts(baseproducts: CRMTypes.GetProductsQuery['evo_baseproducts']) {
|
||||
return {
|
||||
filterBy: {
|
||||
systemuser(systemuser: CRMTypes.GetSystemUserQuery['systemuser']) {
|
||||
if (!evo_baseproducts?.length || !systemuser) return [];
|
||||
systemuser(systemuser: SystemUser) {
|
||||
if (!baseproducts?.length || !systemuser) return [];
|
||||
|
||||
return evo_baseproducts?.filter(
|
||||
return baseproducts?.filter(
|
||||
(evo_baseproduct) =>
|
||||
!evo_baseproduct?.systemusers?.length ||
|
||||
evo_baseproduct?.systemusers?.some(
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
import '../styles/fonts.css';
|
||||
import '../styles/globals.css';
|
||||
import '../styles/antd-fix.css';
|
||||
@ -7,6 +8,7 @@ import initializeApollo from '@/apollo/client';
|
||||
import { Loading, Notification } from '@/Components/Common';
|
||||
import Layout from '@/Components/Layout';
|
||||
import { theme } from '@/config/ui';
|
||||
import { withBasePath } from '@/config/urls';
|
||||
import { usePageLoading } from '@/hooks';
|
||||
import StoreProvider from '@/stores/Provider';
|
||||
import getColors from '@/styles/colors';
|
||||
@ -15,7 +17,7 @@ import { trpcClient } from '@/trpc/client';
|
||||
import { ApolloProvider } from '@apollo/client';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import Head from 'next/head';
|
||||
import { useMemo } from 'react';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
import { Config as AntdConfig } from 'ui/elements';
|
||||
|
||||
@ -32,6 +34,21 @@ function App({ Component, pageProps }) {
|
||||
|
||||
const { loading } = usePageLoading();
|
||||
|
||||
useEffect(() => {
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker
|
||||
.register(withBasePath('/service-worker.js'))
|
||||
.then((registration) => {
|
||||
console.log('Service Worker registered:', registration);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Service Worker registration failed:', error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={theme}>
|
||||
<Head>
|
||||
|
||||
@ -4,7 +4,7 @@ import type { ProcessContext } from '../types';
|
||||
import { createValidationSchema } from './validation';
|
||||
import { selectRequirementTelematic } from '@/config/default-options';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { reaction, toJS } from 'mobx';
|
||||
@ -20,7 +20,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
|
||||
return;
|
||||
}
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const {
|
||||
data: { evo_addproduct_types },
|
||||
@ -77,7 +77,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType']),
|
||||
async ({ leasingPeriod, leaseObjectType }) => {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const {
|
||||
data: { evo_addproduct_types },
|
||||
@ -161,7 +161,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
leasingPeriod,
|
||||
plPriceRub,
|
||||
}) => {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const {
|
||||
data: { evo_addproduct_types },
|
||||
@ -274,7 +274,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
leaseObjectType: leaseObjectTypeId,
|
||||
engineType,
|
||||
}) => {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
const {
|
||||
data: { evo_addproduct_types: trackerTypes },
|
||||
} = await apolloClient.query({
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { ValidationContext } from '../../types';
|
||||
import type { ElementsTypes } from '@/Components/Calculation/config/map/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
|
||||
export type ProductId = ElementsTypes['selectProduct'];
|
||||
|
||||
@ -13,7 +13,7 @@ export default function helper({ apolloClient, user }: ValidationContext) {
|
||||
}
|
||||
|
||||
const {
|
||||
data: { systemuser },
|
||||
data: { systemusers },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetSystemUserDocument,
|
||||
variables: {
|
||||
@ -21,11 +21,13 @@ export default function helper({ apolloClient, user }: ValidationContext) {
|
||||
},
|
||||
});
|
||||
|
||||
const systemuser = systemusers?.[0];
|
||||
|
||||
if (!systemuser?.evo_job_titleid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const {
|
||||
data: { evo_coefficients },
|
||||
|
||||
@ -3,7 +3,7 @@ import defaultValues from '@/config/default-values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import type { CalculationValues } from '@/stores/calculation/values/types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import dayjs from 'dayjs';
|
||||
import { first, sort } from 'radash';
|
||||
|
||||
@ -80,7 +80,7 @@ export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloCli
|
||||
},
|
||||
|
||||
async getRates({ tarif: tarifId }: GetRatesInputValues) {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const {
|
||||
data: { evo_rates },
|
||||
@ -138,7 +138,7 @@ export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloCli
|
||||
floatingRate,
|
||||
partialVAT,
|
||||
}: GetTarifInputValues) {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const {
|
||||
data: { evo_tarifs = [] },
|
||||
|
||||
@ -4,7 +4,7 @@ import { crmTools } from '@/graphql/crm.tools';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { SEASON_TYPES } from '@/process/payments/lib/seasons-constants';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import { reaction } from 'mobx';
|
||||
@ -355,7 +355,7 @@ export default function reactions({ store, apolloClient, user }: ProcessContext)
|
||||
reaction(
|
||||
() => $calculation.element('selectQuote').getValue(),
|
||||
async (quoteId) => {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
let {
|
||||
data: { evo_baseproducts },
|
||||
@ -369,7 +369,7 @@ export default function reactions({ store, apolloClient, user }: ProcessContext)
|
||||
|
||||
if (user && evo_baseproducts) {
|
||||
const {
|
||||
data: { systemuser },
|
||||
data: { systemusers },
|
||||
} = await apolloClient.query({
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetSystemUserDocument,
|
||||
@ -378,9 +378,13 @@ export default function reactions({ store, apolloClient, user }: ProcessContext)
|
||||
},
|
||||
});
|
||||
|
||||
evo_baseproducts = crmTools
|
||||
.evo_baseproducts(evo_baseproducts)
|
||||
.filterBy.systemuser(systemuser);
|
||||
const systemuser = systemusers?.[0];
|
||||
|
||||
if (systemuser) {
|
||||
evo_baseproducts = crmTools
|
||||
.evo_baseproducts(evo_baseproducts)
|
||||
.filterBy.systemuser(systemuser);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$calculation.element('cbxRecalcWithRevision').getValue()) {
|
||||
|
||||
@ -16,23 +16,35 @@ export default function unlimitedReactions({ store, apolloClient }: ProcessConte
|
||||
|
||||
return;
|
||||
}
|
||||
const {
|
||||
data: { leads },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetLeadsDocument,
|
||||
variables: { domainname },
|
||||
});
|
||||
|
||||
$calculation.element('selectLead').setOptions(normalizeOptions(leads));
|
||||
{
|
||||
const { data } = await apolloClient.query({
|
||||
query: CRMTypes.GetLeadsDocument,
|
||||
variables: { domainname },
|
||||
});
|
||||
|
||||
const {
|
||||
data: { opportunities },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetOpportunitiesDocument,
|
||||
variables: { domainname },
|
||||
});
|
||||
const systemuser = data?.systemusers?.[0];
|
||||
|
||||
$calculation.element('selectOpportunity').setOptions(normalizeOptions(opportunities));
|
||||
if (systemuser) {
|
||||
const { leads } = systemuser;
|
||||
|
||||
$calculation.element('selectLead').setOptions(normalizeOptions(leads));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const { data } = await apolloClient.query({
|
||||
query: CRMTypes.GetOpportunitiesDocument,
|
||||
variables: { domainname },
|
||||
});
|
||||
|
||||
const systemuser = data?.systemusers?.[0];
|
||||
|
||||
if (systemuser) {
|
||||
const { opportunities } = systemuser;
|
||||
$calculation.element('selectOpportunity').setOptions(normalizeOptions(opportunities));
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import { STALE_TIME } from '@/constants/request';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import type { CalculationValues } from '@/stores/calculation/values/types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import { flatten } from 'tools/object';
|
||||
|
||||
@ -38,7 +38,7 @@ export default function helper({
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetAddproductTypesDocument,
|
||||
variables: {
|
||||
currentDate: getCurrentISODate(),
|
||||
currentDate: getCurrentDateString(),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import { getTransTax } from '@/api/1c/query';
|
||||
import { selectObjectCategoryTax } from '@/config/default-options';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import dayjs from 'dayjs';
|
||||
@ -250,7 +250,7 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
data: { evo_addproduct_types },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetRegistrationTypesDocument,
|
||||
variables: { currentDate: getCurrentISODate() },
|
||||
variables: { currentDate: getCurrentDateString() },
|
||||
});
|
||||
|
||||
const options = evo_addproduct_types?.filter((x) => {
|
||||
|
||||
@ -4,7 +4,7 @@ import { STALE_TIME } from '@/constants/request';
|
||||
import { crmTools } from '@/graphql/crm.tools';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
@ -16,15 +16,20 @@ import { useEffect } from 'react';
|
||||
* @param {*} onCompleted
|
||||
*/
|
||||
function getMainData({ query }, onCompleted, user) {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
query({
|
||||
query: CRMTypes.GetLeadsDocument,
|
||||
variables: { domainname: user.domainName },
|
||||
}).then(({ data }) => {
|
||||
onCompleted({
|
||||
selectLead: data?.leads,
|
||||
});
|
||||
const systemuser = data?.systemusers?.[0];
|
||||
|
||||
if (systemuser) {
|
||||
const { leads } = systemuser;
|
||||
onCompleted({
|
||||
selectLead: leads,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
query({
|
||||
@ -46,16 +51,22 @@ function getMainData({ query }, onCompleted, user) {
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetSystemUserDocument,
|
||||
variables: { domainname: user?.domainName },
|
||||
}).then(({ data: { systemuser } }) => {
|
||||
query({
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetProductsDocument,
|
||||
variables: { currentDate },
|
||||
}).then(({ data: { evo_baseproducts } }) => {
|
||||
onCompleted({
|
||||
selectProduct: crmTools.evo_baseproducts(evo_baseproducts).filterBy.systemuser(systemuser),
|
||||
}).then(({ data: { systemusers } }) => {
|
||||
const systemuser = systemusers?.[0];
|
||||
|
||||
if (systemuser) {
|
||||
query({
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetProductsDocument,
|
||||
variables: { currentDate },
|
||||
}).then(({ data: { evo_baseproducts } }) => {
|
||||
onCompleted({
|
||||
selectProduct: crmTools
|
||||
.evo_baseproducts(evo_baseproducts)
|
||||
.filterBy.systemuser(systemuser),
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// query({
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import { notification } from '@/Components/Common/Notification';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { reaction } from 'mobx';
|
||||
import { uid } from 'radash';
|
||||
@ -64,7 +64,7 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
firstPaymentPerc,
|
||||
model: modelId,
|
||||
}) => {
|
||||
const currentDate = getCurrentISODate();
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const {
|
||||
data: { evo_addproduct_types },
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { AgentsFields, AgentsRewardConditionsFields, AgentsSumFields } from './types';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type RootStore from '@/stores/root';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import type { ApolloClient } from '@apollo/client';
|
||||
@ -41,7 +41,7 @@ export function fillAgentRewardReaction(
|
||||
query: CRMTypes.GetRewardConditionsDocument,
|
||||
variables: {
|
||||
agentid,
|
||||
currentDate: getCurrentISODate(),
|
||||
currentDate: getCurrentDateString(),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import type { ValidationContext } from '../types';
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import ValuesSchema from '@/config/schema/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import type { RefinementCtx } from 'zod';
|
||||
import { z } from 'zod';
|
||||
@ -29,7 +29,7 @@ function helper({ apolloClient, ctx }: ValidationContext & { ctx: RefinementCtx
|
||||
query: CRMTypes.GetRewardConditionsDocument,
|
||||
variables: {
|
||||
agentid,
|
||||
currentDate: getCurrentISODate(),
|
||||
currentDate: getCurrentDateString(),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
66
apps/web/public/service-worker.js
Normal file
66
apps/web/public/service-worker.js
Normal file
@ -0,0 +1,66 @@
|
||||
self.importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.5.4/workbox-sw.js');
|
||||
|
||||
// This will trigger the importScripts() for workbox.strategies and its dependencies
|
||||
// so that it can be used in the event handlers
|
||||
// https://developer.chrome.com/docs/workbox/modules/workbox-sw/#avoid-async-imports
|
||||
workbox.loadModule('workbox-strategies');
|
||||
workbox.loadModule('workbox-expiration');
|
||||
workbox.loadModule('workbox-routing');
|
||||
|
||||
const cacheName = 'my-cache';
|
||||
|
||||
self.addEventListener('install', function () {
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
const { request } = event;
|
||||
const { pathname } = new URL(event.request.url);
|
||||
|
||||
const createCacheFirstStrategy = ({ items, maxAgeSeconds, maxEntries }) => {
|
||||
items.map((item) => {
|
||||
// if modify method, fetch fresh data:
|
||||
if (event.request.method !== 'GET') {
|
||||
caches.delete(item);
|
||||
} else {
|
||||
event.respondWith(
|
||||
new workbox.strategies.CacheFirst({
|
||||
cacheName,
|
||||
plugins: [
|
||||
// use both: time restrictions and max entries
|
||||
new workbox.expiration.ExpirationPlugin({
|
||||
maxAgeSeconds,
|
||||
maxEntries,
|
||||
}),
|
||||
],
|
||||
}).handle({ event, request })
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
createCacheFirstStrategy({
|
||||
items: ['/', '/unlimited'],
|
||||
maxAgeSeconds: 60,
|
||||
maxEntries: 15,
|
||||
});
|
||||
|
||||
// optional: if you want to have a way to bust all caches quickly
|
||||
if (pathname.includes('/refresh')) {
|
||||
caches.keys().then((names) => names.map((name) => caches.delete(name)));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
// workbox.routing.registerRoute(
|
||||
// ({ request }) => request.destination === '/',
|
||||
// new workbox.strategies.CacheFirst({
|
||||
// cacheName: 'my-cache',
|
||||
// plugins: [
|
||||
// new workbox.expiration.ExpirationPlugin({
|
||||
// maxAgeSeconds: 60, // Время кэширования в секундах
|
||||
// }),
|
||||
// ],
|
||||
// })
|
||||
// );
|
||||
@ -18,7 +18,7 @@ export const userMiddleware = t.middleware(async ({ ctx, next }) => {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
const {
|
||||
data: { systemuser },
|
||||
data: { systemusers },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetSystemUserDocument,
|
||||
variables: {
|
||||
@ -26,6 +26,8 @@ export const userMiddleware = t.middleware(async ({ ctx, next }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const systemuser = systemusers?.at(0);
|
||||
|
||||
const unlimited = systemuser?.roles?.some((x) => x?.name && unlimitedRoles.includes(x.name));
|
||||
|
||||
return next({
|
||||
|
||||
@ -5,7 +5,7 @@ import { ESN, NSIB_MAX, VAT } from '@/constants/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import helper from '@/process/calculate/lib/helper';
|
||||
import { createCurrencyUtility } from '@/utils/currency';
|
||||
import { getCurrentISODate } from '@/utils/date';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { min, sum } from 'radash';
|
||||
@ -76,7 +76,7 @@ export async function createRequestData({
|
||||
|
||||
const currentDate = dayjs().utc(false);
|
||||
|
||||
let systemuser: CRMTypes.GetSystemUserQuery['systemuser'] = null;
|
||||
let systemuser: NonNullable<CRMTypes.GetSystemUserQuery['systemusers']>[number] = null;
|
||||
|
||||
if (user?.domainName) {
|
||||
const { data } = await apolloClient.query({
|
||||
@ -85,7 +85,7 @@ export async function createRequestData({
|
||||
domainname: user.domainName,
|
||||
},
|
||||
});
|
||||
if (data.systemuser) systemuser = data.systemuser;
|
||||
systemuser = data.systemusers?.at(0) ?? null;
|
||||
}
|
||||
|
||||
async function getDeprecation() {
|
||||
@ -127,7 +127,7 @@ export async function createRequestData({
|
||||
await apolloClient.query({
|
||||
query: CRMTypes.GetCoefficientsDocument,
|
||||
variables: {
|
||||
currentDate: getCurrentISODate(),
|
||||
currentDate: getCurrentDateString(),
|
||||
},
|
||||
})
|
||||
).data.evo_coefficients
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { getCurrentISODate } from './date';
|
||||
import { getCurrentDateString } from './date';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ApolloClient } from '@apollo/client';
|
||||
|
||||
@ -33,7 +33,7 @@ export function createCurrencyUtility({ apolloClient }: Context) {
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetCurrencyChangesDocument,
|
||||
variables: {
|
||||
currentDate: getCurrentISODate(),
|
||||
currentDate: getCurrentDateString(),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -11,6 +11,10 @@ export function getCurrentISODate() {
|
||||
return _currentDate().toISOString();
|
||||
}
|
||||
|
||||
export function getCurrentDateString() {
|
||||
return _currentDate().format('YYYY-MM-DD');
|
||||
}
|
||||
|
||||
export function getCurrentDate() {
|
||||
return _currentDate().toDate();
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ export function makeGetUserType({ apolloClient, queryClient }: MakeGetUserTypePr
|
||||
);
|
||||
|
||||
const {
|
||||
data: { systemuser },
|
||||
data: { systemusers },
|
||||
} = await apolloClient.query({
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetSystemUserDocument,
|
||||
@ -40,6 +40,8 @@ export function makeGetUserType({ apolloClient, queryClient }: MakeGetUserTypePr
|
||||
},
|
||||
});
|
||||
|
||||
const systemuser = systemusers?.[0];
|
||||
|
||||
const roles = systemuser?.roles ? sift(systemuser?.roles)?.map((x) => x?.name) : [];
|
||||
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user