Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Address } from './address.js';
import { Assignment } from './assignment.js';
import { Company } from './company.js';
import { CountryTax } from './country_tax.js';
import { Domain } from './domain.js';
import { DomainTag } from './domain_tag.js';
import { Draft } from './draft.js';
import { DraftComment } from './draft_comment.js';
import { EmailAddress } from './email_address.js';
import { Entity } from '../entity.js';
import { MerchiFile } from './file.js';
import { MatchingInventory } from './matching_inventory.js';
import { InternalTag } from './internal_tag.js';
import { Invoice } from './invoice.js';
import { JobComment } from './job_comment.js';
import { JobNote } from './job_note.js';
import { JobOperationLog } from './job_operation_log.js';
import { Notification } from './notification.js';
import { PhoneNumber } from './phone_number.js';
import { Product } from './product.js';
import { Reminder } from './reminder.js';
import { RequestOptions } from '../request.js';
import { Shipment } from './shipment.js';
import { User } from './user.js';
import { Variation } from './variation.js';
import { VariationsGroup } from './variations_group.js';
import { InventoryStatus } from '../constants/inventory_statuses.js';
import { Item } from './item.js';
export class Job extends Entity {
protected static resourceName = 'jobs';
protected static singularName = 'job';
protected static pluralName = 'jobs';
@Job.property({type: Date})
public archived?: Date | null;
@Job.property()
public id?: number;
@Job.property()
public jobType?: number;
@Job.property()
public quantity?: number;
@Job.property()
public currency?: string;
@Job.property({arrayType: 'JobNote'})
public jobNotes?: JobNote[];
@Job.property({arrayType: 'JobOperationLog'})
public operationLogs?: JobOperationLog[];
@Job.property({type: String})
public shopifyShopUrl?: string | null;
@Job.property()
public shopifyOrderId?: string;
@Job.property()
public shopifyOrderLineItemId?: string;
@Job.property({type: Number})
public productionStatus?: number | null;
@Job.property({type: Number})
public designStatus?: number | null;
@Job.property({type: Number})
public supplyChainRequestStatus?: number | null;
@Job.property()
public needsDrafting?: boolean;
@Job.property()
public needsGroupBuy?: boolean;
@Job.property()
public needsProduction?: boolean;
@Job.property()
public needsShipping?: boolean;
@Job.property()
public needsInvoicing?: boolean;
@Job.property()
public needsInventory?: boolean;
@Job.property()
public needsSupplyChainRequest?: boolean;
@Job.property()
public showProductionFilesToClient?: boolean;
@Job.property()
public allowClientDraftContribution?: boolean;
@Job.property()
public quoteSet?: boolean;
@Job.property()
public jobInfoApprovedByClient?: boolean;
@Job.property({type: Number})
public groupBuyStatus?: number | null;
@Job.property({type: Number})
public paymentStatus?: number | null;
@Job.property({type: Date})
public deductionDate?: Date | null;
@Job.property({type: Number})
public shippingStatus?: number | null;
@Job.property()
public completed?: boolean;
@Job.property()
public callToActions?: string;
@Job.property()
public callToActionDetails?: any[];
@Job.property()
public priority?: number;
@Job.property({type: Number})
public jobWeight?: number | null;
@Job.property({type: Number})
public jobVolume?: number | null;
@Job.property()
public received?: Date;
@Job.property()
public deadline?: Date;
@Job.property()
public updated?: Date;
@Job.property({type: Date})
public dateLastActioned?: Date | null;
@Job.property({type: Date})
public dateFirstActioned?: Date | null;
@Job.property()
public groupBuyProductionStarted?: Date;
@Job.property()
public automaticPriceEnabled?: boolean;
@Job.property()
public dropShip?: boolean;
@Job.property()
public pickUp?: boolean;
@Job.property({type: Number})
public costPerUnit?: number | null;
@Job.property({type: Number})
public cost?: number | null;
@Job.property({type: Number})
public taxAmount?: number | null;
@Job.property({type: Number})
public totalCost?: number | null;
@Job.property({embeddedByDefault: false})
public inventoriesStatus?: InventoryStatus;
@Job.property({embeddedByDefault: false})
public unreadNotificationsCount?: number;
@Job.property({embeddedByDefault: false})
public unreadJobInfoNotificationsCount?: number;
@Job.property({embeddedByDefault: false})
public unreadJobDraftingNotificationsCount?: number;
@Job.property({embeddedByDefault: false})
public unreadJobProductionNotificationsCount?: number;
@Job.property({embeddedByDefault: false})
public unreadJobShippingNotificationsCount?: number;
@Job.property({embeddedByDefault: false})
public unreadJobInvoicingNotificationsCount?: number;
@Job.property({embeddedByDefault: false})
public limitedStock?: boolean;
@Job.property({embeddedByDefault: false})
public inventoryCount?: number;
@Job.property({embeddedByDefault: false})
public inventorySufficient?: boolean;
@Job.property({arrayType: 'Item'})
public items?: Item[];
@Job.property({arrayType: 'Draft'})
public drafts?: Draft[];
@Job.property({arrayType: 'Draft'})
public sharedDrafts?: Draft[];
@Job.property({arrayType: 'Draft'})
public ownDrafts?: Draft[];
@Job.property({arrayType: 'JobComment'})
public comments?: JobComment[];
@Job.property()
public client?: User;
@Job.property()
public clientBrowser?: string;
@Job.property()
public clientDevice?: string;
@Job.property()
public clientOs?: string;
@Job.property({type: User})
public manager?: User | null;
@Job.property({type: User})
public designer?: User | null;
@Job.property({type: Company})
public clientCompany?: Company | null;
@Job.property({type: PhoneNumber})
public clientPhone?: PhoneNumber | null;
@Job.property({type: EmailAddress})
public clientEmail?: EmailAddress | null;
@Job.property({type: PhoneNumber})
public clientCompanyPhone?: PhoneNumber | null;
@Job.property({type: EmailAddress})
public clientCompanyEmail?: EmailAddress | null;
@Job.property({type: 'Product'})
public product?: Product;
@Job.property()
public supplyChainRequestProduct?: Product;
@Job.property({arrayType: 'DraftComment'})
public draftComments?: DraftComment[];
@Job.property()
public preDraftCommentsCount?: number;
@Job.property({type: CountryTax})
public taxType?: CountryTax | null;
@Job.property({arrayType: 'InternalTag'})
public internalTags?: InternalTag[];
@Job.property({arrayType: 'DomainTag'})
public tags?: DomainTag[];
@Job.property({arrayType: 'Product'})
public createdProducts?: Product[];
@Job.property({type: Address})
public shipping?: Address | null;
@Job.property({type: Address})
public productionShippingAddress?: Address | null;
@Job.property()
public domain?: Domain;
@Job.property({type: Invoice})
public invoice?: Invoice | null;
@Job.property({arrayType: 'MerchiFile'})
public productionFiles?: MerchiFile[];
@Job.property({arrayType: 'MerchiFile'})
public clientFiles?: MerchiFile[];
@Job.property({type: Shipment})
public shipment?: Shipment | null;
@Job.property({arrayType: 'MatchingInventory'})
public matchingInventories?: MatchingInventory[];
@Job.property({arrayType: 'VariationsGroup'})
public variationsGroups?: VariationsGroup[];
@Job.property({arrayType: 'Variation'})
public variations?: Variation[];
@Job.property({arrayType: 'Notification'})
public notifications?: Notification[];
@Job.property({arrayType: 'Assignment'})
public assignments?: Assignment[];
@Job.property({arrayType: 'Reminder'})
public reminders?: Reminder[];
@Job.property()
public supplyAssignment?: Assignment;
@Job.property()
public supplyJob?: Job;
@Job.property()
public supplyQuoteTotalCost?: number;
@Job.property()
public hasValidVolume?: boolean;
@Job.property()
public hasValidWeight?: boolean;
@Job.property()
public isNewClient?: boolean;
public getQuote = () => {
const resource = '/specialised-order-estimate/';
const data = this.toFormData({excludeOld: false});
const fetchOptions: RequestOptions = {method: 'POST', body: data};
fetchOptions.query = [];
fetchOptions.query.push(['skip_rights', 'y']);
// insert product id to query for debug purposes
fetchOptions.query.push([
'product_id',
this.product!.id ? this.product!.id!.toString() : 'null'
]);
return this.merchi.authenticatedFetch(resource, fetchOptions).
then((data: any) => { this.fromJson(data, {makeDirty: true});
return this;});
};
public deduct = (matchingInventories: MatchingInventory[]) => {
const resource = `/jobs/${this.id}/inventories_subtract/`;
const inventoriesNeedToBeDeducted = matchingInventories.map(
matchingInventory => matchingInventory.inventory!.id);
const embed = {matchingInventories: {inventory: {}, group: {}}};
const data = new FormData();
data.append('inventories', JSON.stringify(inventoriesNeedToBeDeducted));
const fetchOptions: RequestOptions = {
method: 'POST',
body: data,
query: [['embed', JSON.stringify(embed)]]
};
return this.merchi.authenticatedFetch(resource, fetchOptions).
then((data: any) => {
this.fromJson(data);
return this;});
};
public bulkDeduct = () => {
Iif (this.matchingInventories === undefined) {
const err = 'matchingInventories is undefined, did you forget to embed' +
' it?';
throw new Error(err);
}
return this.deduct(this.matchingInventories);
};
}
|